Skip to content

Commit

Permalink
Landing page (#41)
Browse files Browse the repository at this point in the history
* Adds setTokens (#33)

* wip

* article css

* landing page styling wip

* footer

* remove hyperlink from receipt expand block

* landing page light mode

* mobile responsiveness

---------

Co-authored-by: abtestingalpha <[email protected]>
  • Loading branch information
lawsonkight and abtestingalpha authored Dec 12, 2023
1 parent 762abc9 commit 506bd9c
Show file tree
Hide file tree
Showing 7 changed files with 504 additions and 181 deletions.
30 changes: 30 additions & 0 deletions examples/with-react/public/synapse-logo-onLight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
199 changes: 114 additions & 85 deletions examples/with-react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Bridge, USDC, USDT, DAI } from '@synapsecns/widget'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import { useEthereumWallet } from './hooks/useEthereumWallet'
import { BaseSyntheticEvent, useState } from 'react'
import Header from './Header'
import Footer from './Footer'

const tokens = [USDC, USDT, DAI]

Expand Down Expand Up @@ -78,108 +80,135 @@ function App() {

return (
<>
<header style={{ placeContent: 'space-between' }}>
<img width="160" src="/synapse-logo.svg" alt="Synapse logo" />
<a href="https://synapseprotocol.com" target="_blank" rel="noreferrer">
EVM Bridge
</a>
</header>

<main style={{ flexDirection: 'column' }}>
<Header />

<main>
<header>
<h1>Synapse Widget</h1>
<code>npm synapse-widget</code>
<h1>Install the Synapse Bridge</h1>
<pre>npm synapse-widget</pre>
<p>
Easily onboard new users by adding a custom instance of the Synapse
Bridge to your React project
</p>
</header>
<Bridge
chainIds={chainIds}
web3Provider={web3Provider}
networkProviders={providers}
tokens={tokens}
customTheme={customTheme}
/>
<div>
<div id="example-container">
<div id="bridge-container">
<Bridge
chainIds={chainIds}
web3Provider={web3Provider}
networkProviders={providers}
tokens={tokens}
customTheme={customTheme}
/>
</div>
<input id="color-picker" type="color" onInput={createCustomTheme} />
{/* &nbsp;
<label htmlFor='color-picker'>Background</label>
&nbsp;
&nbsp;
<input
id="accent-color-picker"
type="color"
onInput={createCustomTheme}
/>
&nbsp;
<label htmlFor='accent-color-picker'>Accent</label> */}
</div>
</header>
{/* <Bridge
chainIds={chainIds}
web3Provider={web3Provider}
networkProviders={providers}
tokens={tokens}
theme="night"
/> */}
<h2>Customize</h2>
<h3>Token list</h3>
TODO: Describe how to customize the source or destination token lists
<h3>Appearance</h3>
<h4>Dark mode</h4>
To override the default light theme, set the bgColor property to dark.
<pre>customTheme = &#123; bgColor: 'dark' &#125;</pre>
<h4>Auto-palette</h4>
Generate a palette based on your brand colors by setting bgColor to any
hex, rgb, or hsl color string. Hex values must contain 6 characters.
<pre>
customTheme = &#123;
<br /> bgColor: '#000A14'
<br /> bgColor: 'rgb(0 10 20)'
<br /> bgColor: 'hsl(210deg 100% 4%)'
<br />
&#125;
</pre>
{/* <h4>Accent Color</h4>
Add an accent color to text links and button hover states by setting accentColor to any hex, rgb, or hsl color string.
<pre>
customTheme = &#123;
<br /> accentColor: '#d557ff'
<br /> accentColor: 'rgb(213 87 255)'
<br /> accentColor: 'hsl(285deg 100% 67%)'
<br />&#125;
</pre> */}
<h4>Overrides</h4>
The following CSS variables can be added to your CustomTheme to override
the generated values. Any valid CSS color string can be used, including
var() aliases.
<pre>
{/* <hr /> */}
<article>

<h2>⬇️&nbsp; Install</h2>
<p>
Install the Synapse Widget in your Next.js or React project
</p>
<pre>npm synapse-widget</pre>

<h2>⚙️&nbsp; Setup</h2>
<h3>Supported tokens</h3>
<p>
While the Synapse Widget supports <a href="https://synapseprotocol.com" target="_blank" rel="noreferrer">hundreds of tokens and chains</a>, for a streamlined user experience, you can render a separate instance of the bridge for each user need.
</p>
<p>
For example: separate <code>BridgeIn</code> and <code>BridgeOut</code> functions allow you to define the tokens you support sending and receiving.
</p>
<p className="info">
<strong>Note</strong>: Whitelisting one side of a transaction limits the other side to compatible tokens automatically.
</p>
<pre>
{`// Bridge in
tokenList = {
source: [], destination: [ token, token, token ]
}
// Bridge out
tokenList = {
source: [ token, token, token ], destination: [],
}`}
</pre>

<h2>
🎨&nbsp; Customize
</h2>
<h3>
Dark mode
</h3>
<p>
To override the default light theme, set &nbsp;<code>bgColor</code>&nbsp; to &nbsp;<code>'dark'</code>&nbsp;.
</p>
<pre>customTheme = &#123; bgColor: 'dark' &#125;</pre>
<h3>
Auto-palette
</h3>
<p>
Generate a palette based on your brand colors by setting bgColor to any hex, rgb, or hsl color string. Hex values must contain 6 characters.
</p>
<pre>
{`customTheme = {
bgColor: '#000A14'
bgColor: 'rgb(0 10 20)'
bgColor: 'hsl(210deg 100% 4%)'
}`}
</pre>
{/* <h3>Accent Color</h3>
Add an accent color to text links and button hover states by setting accentColor to any hex, rgb, or hsl color string.
<pre>
customTheme = &#123;
<br /> --synapse-text-primary: 'white'
<br /> --synapse-text-secondary: '#cccccc'
<br />
<br /> --synapse-bg-select: 'hsl(210deg 100% 50%)'
<br /> --synapse-bg-surface: 'hsl(210deg 100% 12.5%)'
<br /> --synapse-bg-root: 'inherit'
<br />
<br /> --synapse-border: 'hsl(210deg 100% 25%)'
<br /> --synapse-border-hover: 'hsl(285deg 100% 33%)'
<br />
<br /> --synapse-accent: 'var(--my-brand-color)'
<br />
&#125;
</pre>
{/* <h4>Typography — WIP, not reflected in code</h4>
<dl>
<dt>--synapse-font-size</dt><dd>100%</dd>
<dt>--synapse-font-family-display</dt><dd>system-ui</dd>
<dt>--synapse-font-family-text</dt><dd>system-ui</dd>
<dt>--synapse-font-weight-display</dt><dd>600 (semibold)</dd>
<dt>--synapse-font-weight-text</dt><dd>500 (medium)</dd>
</dl> */}
<br /> accentColor: '#d557ff'
<br /> accentColor: 'rgb(213 87 255)'
<br /> accentColor: 'hsl(285deg 100% 67%)'
<br />&#125;
</pre> */}
<h3>Overrides</h3>
<p>
The following CSS variables can be added to your CustomTheme to override the generated values. Any valid CSS color string can be used, including var() aliases.
</p>
<pre>
{`customTheme = {
--synapse-text-primary: 'white'
--synapse-text-secondary: '#cccccc'
--synapse-bg-select: 'hsl(210deg 100% 50%)'
--synapse-bg-surface: 'hsl(210deg 100% 12.5%)'
--synapse-bg-root: 'inherit'
--synapse-border: 'hsl(210deg 100% 25%)'
--synapse-border-hover: 'hsl(285deg 100% 33%)'
}`}
</pre>
{/* <h3>Typography — WIP, not reflected in code</h3>
<dl>
<dt>--synapse-font-size</dt><dd>100%</dd>
<dt>--synapse-font-family-display</dt><dd>system-ui</dd>
<dt>--synapse-font-family-text</dt><dd>system-ui</dd>
<dt>--synapse-font-weight-display</dt><dd>600 (semibold)</dd>
<dt>--synapse-font-weight-text</dt><dd>500 (medium)</dd>
</dl> */}
<h2>
🙋&nbsp; Support
</h2>
<p>
For help and feedback, reach out to our Support team in the <a href="#" target="_blank" rel="noreferrer">Synapse Discord channel.</a>
</p>
</article>
</main>

<footer></footer>
<Footer />
</>
)
}
Expand Down
67 changes: 67 additions & 0 deletions examples/with-react/src/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
type Props = {
header: string
links: { label: string, url: string }[]
}

function FooterSection({ header, links }: Props) {

return <section>

<header>{header}</header>

{links.map(link =>

<a key={link.label} href={link.url}>
<span>{link.label}</span>
</a>

)}

</section>

}

export default function Footer() {

return <footer>

<div>

<a href="https://synapseprotocol.com/landing">
<picture>
<source srcSet="synapse-logo-onLight.svg" media="(prefers-color-scheme: light)" />
<source srcSet="synapse-logo-onDark.svg" media="(prefers-color-scheme: dark)" />
<img src="synapse-logo-onDark.svg" width="160" alt="Synapse Logo" />
</picture>
</a>

<nav>

<FooterSection header='Functions' links={[
{ label: 'Swap', url: '#', },
{ label: 'Bridge', url: '#', },
{ label: 'Pools', url: '#', },
{ label: 'Stake', url: '#', },
]}/>

<FooterSection header='Developers' links={[
{ label: 'Build on Synapse', url: '#', },
{ label: 'Documentation', url: '#', },
{ label: 'Github', url: '#', },
{ label: 'Blog', url: '#', },
]}/>

<FooterSection header='Support' links={[
{ label: 'Discord', url: '#', },
{ label: 'Twitter', url: '#', },
{ label: 'Forum', url: '#', },
{ label: 'Telegram', url: '#', },
]}/>

</nav>

</div>

</footer>

}
50 changes: 50 additions & 0 deletions examples/with-react/src/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

type Props = {
links: { label: string; url: string; selected?: boolean }[]
}

function HeaderSection({ links }: Props) {

return (
<nav>
{links.map((link, i) => {
return (
<a
key={i}
href={link.url}
target="_blank" rel="noreferrer"
className={`${link.selected ? 'selected' : ''}`}
>
{link.label}
</a>
)
})}

{/* <NavOverflow links={links} /> */}
{/* <a onClick={handleClick}>More…</a> */}
</nav>
)
}

export default function Header() {
return (
<header>
<a href="https://synapseprotocol.com/landing">
<picture>
<source srcSet="synapse-logo-onLight.svg" media="(prefers-color-scheme: light)" />
<source srcSet="synapse-logo-onDark.svg" media="(prefers-color-scheme: dark)" />
<img src="synapse-logo-onDark.svg" width="200" alt="Synapse Logo" />
</picture>
</a>

<HeaderSection
links={[
{ label: 'Widget', url: '#', selected: true },
{ label: 'Docs', url: '#' },
{ label: 'EVM Bridge', url: 'https://synapseprotocol.com' },
// { label: 'Synapse Interchain Network', url: '#', },
]}
/>
</header>
)
}
Loading

0 comments on commit 506bd9c

Please sign in to comment.