Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable linting in react example and fix lint errors #182

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/react-widget-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc && vite build",
"lint": "yarn run lint:types && yarn run lint:code",
"lint:types": "tsc -p ./tsconfig.json --noEmit",
"lint:code": "eslint '{src,tests}/**/*.ts'",
"lint:code": "eslint '{src,tests}/**/*.{ts,tsx}'",
"preview": "vite preview"
},
"dependencies": {
Expand Down
6 changes: 6 additions & 0 deletions examples/react-widget-app/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ body, html {
}

#open-sidebar-button {
background: none repeat scroll 0 0 transparent;
border: medium none;
border-spacing: 0;
position: fixed;
top: 2rem;
left: 2rem;
Expand All @@ -105,6 +108,9 @@ body, html {
}

#close-icon{
background: none repeat scroll 0 0 transparent;
border: medium none;
border-spacing: 0;
position: absolute;
top: 0.5rem;
right: 0.5rem;
Expand Down
72 changes: 45 additions & 27 deletions examples/react-widget-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,77 @@
import { SygmaProtocolReactWidget } from '@buildwithsygma/sygmaprotocol-react-widget'
import './App.css';
import sygmaIcon from './public/sygmaIcon.svg'
import gitHubIcon from './public/githubIcon.png'
import docsIcon from './public/docsIcon.png'
import closeIcon from './public/closeIcon.png'
import sidebarIcon from './public/sidebarIcon.png'
import { useState } from 'react';
import { SygmaProtocolReactWidget } from '@buildwithsygma/sygmaprotocol-react-widget';

function App() {
import closeIcon from './public/closeIcon.png';
import docsIcon from './public/docsIcon.png';
import gitHubIcon from './public/githubIcon.png';
import sidebarIcon from './public/sidebarIcon.png';
import sygmaIcon from './public/sygmaIcon.svg';

import './App.css';

function App() {
const [sidebarOpen, setSidebarOpen] = useState(false);

const toggleSidebar = () => {
setSidebarOpen(!sidebarOpen);
};

const obtainTokensClick = () => {
window.open("https://docs.buildwithsygma.com/environments/testnet/obtain-testnet-tokens", "_blank");
window.open(
'https://docs.buildwithsygma.com/environments/testnet/obtain-testnet-tokens',
'_blank',
);
};

return (

<div className="page">
<aside className={`sidebar centered ${sidebarOpen ? 'open' : ''}`}>
{sidebarOpen && (
<div id="close-icon" onClick={toggleSidebar}>
<button type="button" id="close-icon" onClick={toggleSidebar}>
<img src={closeIcon} alt="Close Sidebar" className="icon" />
</div>
)}
</button>
)}
<div className="sidebar-title">Sygma Widget</div>
<div className="icon-column">
<div className="icon-column">
<div className="icon-wrapper">
<a href="https://buildwithsygma.com/" target="_blank"><img src={sygmaIcon} alt="Main Page" /></a>
<a href="https://buildwithsygma.com/" target="_blank"><span>Website</span></a>
<a href="https://buildwithsygma.com/" target="_blank" rel="noreferrer">
<img src={sygmaIcon} alt="Main Page" />
</a>
<a href="https://buildwithsygma.com/" target="_blank" rel="noreferrer">
<span>Website</span>
</a>
</div>
<div className="icon-wrapper">
<a href="https://docs.buildwithsygma.com/" target="_blank"><img src={docsIcon} alt="Documentation"/></a>
<a href="https://docs.buildwithsygma.com/" target="_blank"><span>Docs</span></a>
<a href="https://docs.buildwithsygma.com/" target="_blank" rel="noreferrer">
<img src={docsIcon} alt="Documentation" />
</a>
<a href="https://docs.buildwithsygma.com/" target="_blank" rel="noreferrer">
<span>Docs</span>
</a>
</div>
<div className="icon-wrapper">
<a href="https://github.com/sygmaprotocol" target="_blank"><img src={gitHubIcon} alt="GitHub" id="github-icon"/></a>
<a href="https://github.com/sygmaprotocol" target="_blank"><span>GitHub</span></a>
<a href="https://github.com/sygmaprotocol" target="_blank" rel="noreferrer">
<img src={gitHubIcon} alt="GitHub" id="github-icon" />
</a>
<a href="https://github.com/sygmaprotocol" target="_blank" rel="noreferrer">
<span>GitHub</span>
</a>
</div>
<button className="sidebar-button" onClick={obtainTokensClick}>Obtain Testnet Tokens</button>
<button type="button" className="sidebar-button" onClick={obtainTokensClick}>
Obtain Testnet Tokens
</button>
</div>
</aside>
<main className={"main centered"}>
<main className="main centered">
<SygmaProtocolReactWidget />
</main>
{!sidebarOpen && (
<div id="open-sidebar-button" onClick={toggleSidebar}>
<button type="button" id="open-sidebar-button" onClick={toggleSidebar}>
<img src={sidebarIcon} alt="Toggle Sidebar" className="icon" />
</div>
</button>
)}
</div>
)
}
export default App
);
}

export default App;
Loading