Commit c28884f4 authored by Callil Capuozzo's avatar Callil Capuozzo Committed by Noah Zinsmeister

Add theme toggle and footer (#400)

parent 80da6e0f
...@@ -14,7 +14,7 @@ const SummaryWrapper = styled.div` ...@@ -14,7 +14,7 @@ const SummaryWrapper = styled.div`
` `
const Details = styled.div` const Details = styled.div`
background-color: ${({ theme }) => theme.doveGray}; background-color: ${({ theme }) => theme.concreteGray};
padding: 1.5rem; padding: 1.5rem;
border-radius: 1rem; border-radius: 1rem;
font-size: 0.75rem; font-size: 0.75rem;
......
import React from 'react'
import styled from 'styled-components'
import { Link } from '../../theme'
import { darken } from 'polished'
import { useDarkModeManager } from '../../contexts/LocalStorage'
import Toggle from 'react-toggle'
import { transparentize } from 'polished'
import 'react-toggle/style.css'
const FooterFrame = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
`
const FooterElement = styled.div`
margin: 1.25rem;
display: flex;
min-width: 0;
display: flex;
align-items: center;
`
const Title = styled.div`
display: flex;
align-items: center;
color: ${({ theme }) => theme.uniswapPink};
:hover {
cursor: pointer;
}
#link {
text-decoration-color: ${({ theme }) => theme.uniswapPink};
}
#title {
display: inline;
font-size: 0.825rem;
margin-right: 12px;
font-weight: 400;
color: ${({ theme }) => theme.uniswapPink};
:hover {
color: ${({ theme }) => darken(0.2, theme.uniswapPink)};
}
}
`
const EmojiToggle = styled.span`
position: relative;
font-size: 15px;
font-family: 'Arial sans-serif';
`
const ToggleComponent = styled(Toggle)`
margin-right: 24px;
.react-toggle-track {
background-color: ${({ theme }) => theme.inputBackground} !important;
border: 1px solid ${({ theme }) => theme.concreteGray};
}
.react-toggle-track-x {
line-height: unset;
bottom: auto;
right: 14px;
}
.react-toggle-track-check {
line-height: unset;
bottom: auto;
left: 7px;
}
&&& .react-toggle-thumb {
background-color: ${({ theme }) => theme.inputBackground};
box-shadow: 0 4px 8px 0 ${({ theme }) => transparentize(0.93, theme.royalBlue)};
border: 1px solid ${({ theme }) => theme.mercuryGray};
border-color: ${({ theme }) => theme.mercuryGray} !important;
/* border: none; */
top: 2px;
left: ${({ defaultChecked }) => (defaultChecked ? '28px' : '2px')};
}
`
function ToggleIcon(props) {
return (
<EmojiToggle role="img" aria-label="sun">
{props.content}
</EmojiToggle>
)
}
export default function Footer() {
const [isDark, toggleDarkMode] = useDarkModeManager()
return (
<FooterFrame>
<FooterElement>
<Title>
<Link id="link" href="https://uniswap.io/">
<h1 id="title">About</h1>
</Link>
<Link id="link" href="https://docs.uniswap.io/">
<h1 id="title">Docs</h1>
</Link>
<Link id="link" href="https://github.com/Uniswap">
<h1 id="title">Code</h1>
</Link>
</Title>
</FooterElement>
<ToggleComponent
defaultChecked={!isDark}
icons={{ checked: <ToggleIcon content="☀️" />, unchecked: <ToggleIcon content="🌙️" /> }}
onChange={toggleDarkMode}
/>
</FooterFrame>
)
}
...@@ -4,35 +4,41 @@ import styled from 'styled-components' ...@@ -4,35 +4,41 @@ import styled from 'styled-components'
import { Link } from '../../theme' import { Link } from '../../theme'
import Web3Status from '../Web3Status' import Web3Status from '../Web3Status'
import { darken } from 'polished' import { darken } from 'polished'
import { useDarkModeManager } from '../../contexts/LocalStorage'
const HeaderFrame = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
`
const HeaderElement = styled.div` const HeaderElement = styled.div`
margin: 1.25rem; margin: 1.25rem;
display: flex; display: flex;
min-width: 0; min-width: 0;
`
const Title = styled.div`
display: flex; display: flex;
align-items: center; align-items: center;
`
:hover { const Nod = styled.span`
cursor: pointer;
}
#image {
font-size: 1.5rem;
margin-right: 1rem;
transform: rotate(0deg); transform: rotate(0deg);
transition: transform 150ms ease-out; transition: transform 150ms ease-out;
:hover { :hover {
transform: rotate(-10deg); transform: rotate(-10deg);
} }
`
const Title = styled.div`
display: flex;
align-items: center;
:hover {
cursor: pointer;
} }
#link { #link {
text-decoration-color: ${({ theme }) => theme.wisteriaPurple}; text-decoration-color: ${({ theme }) => theme.UniswapPink};
} }
#title { #title {
...@@ -47,25 +53,25 @@ const Title = styled.div` ...@@ -47,25 +53,25 @@ const Title = styled.div`
` `
export default function Header() { export default function Header() {
const [, toggleDarkMode] = useDarkModeManager()
return ( return (
<> <HeaderFrame>
<HeaderElement> <HeaderElement>
<Title> <Title>
<span onClick={toggleDarkMode} id="image" role="img" aria-label="Unicorn Emoji"> <Nod>
🦄 <Link id="link" href="https://uniswap.io">
<span role="img" aria-label="unicorn">
🦄{' '}
</span> </span>
</Link>
</Nod>
<Link id="link" href="https://uniswap.io"> <Link id="link" href="https://uniswap.io">
<h1 id="title">Uniswap</h1> <h1 id="title">Uniswap</h1>
</Link> </Link>
</Title> </Title>
</HeaderElement> </HeaderElement>
<HeaderElement> <HeaderElement>
<Web3Status /> <Web3Status />
</HeaderElement> </HeaderElement>
</> </HeaderFrame>
) )
} }
...@@ -87,6 +87,8 @@ const Popup = styled(Flex)` ...@@ -87,6 +87,8 @@ const Popup = styled(Flex)`
padding: 0.6rem 1rem; padding: 0.6rem 1rem;
line-height: 150%; line-height: 150%;
background: ${({ theme }) => theme.inputBackground}; background: ${({ theme }) => theme.inputBackground};
border: 1px solid ${({ theme }) => theme.mercuryGray};
border-radius: 8px; border-radius: 8px;
animation: ${fadeIn} 0.15s linear; animation: ${fadeIn} 0.15s linear;
......
...@@ -4,6 +4,8 @@ import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom' ...@@ -4,6 +4,8 @@ import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom'
import Web3ReactManager from '../components/Web3ReactManager' import Web3ReactManager from '../components/Web3ReactManager'
import Header from '../components/Header' import Header from '../components/Header'
import Footer from '../components/Footer'
import NavigationTabs from '../components/NavigationTabs' import NavigationTabs from '../components/NavigationTabs'
import { isAddress } from '../utils' import { isAddress } from '../utils'
...@@ -11,30 +13,45 @@ const Swap = lazy(() => import('./Swap')) ...@@ -11,30 +13,45 @@ const Swap = lazy(() => import('./Swap'))
const Send = lazy(() => import('./Send')) const Send = lazy(() => import('./Send'))
const Pool = lazy(() => import('./Pool')) const Pool = lazy(() => import('./Pool'))
const AppWrapper = styled.div`
display: flex;
flex-flow: column;
align-items: flex-start;
height: 100vh;
`
const HeaderWrapper = styled.div` const HeaderWrapper = styled.div`
${({ theme }) => theme.flexRowNoWrap} ${({ theme }) => theme.flexRowNoWrap}
width: 100%; width: 100%;
justify-content: space-between; justify-content: space-between;
` `
const FooterWrapper = styled.div`
width: 100%;
min-height: 30px;
align-self: flex-end;
`
const BodyWrapper = styled.div` const BodyWrapper = styled.div`
${({ theme }) => theme.flexRowNoWrap} display: flex;
flex-direction: column;
width: 100%; width: 100%;
justify-content: center; justify-content: flex-start;
flex-grow: 1; align-items: center;
flex-basis: 0; flex: 1;
overflow: auto; overflow: auto;
` `
const Body = styled.div` const Body = styled.div`
width: 35rem; max-width: 35rem;
margin: 1.25rem; width: 90%;
/* margin: 0 1.25rem 1.25rem 1.25rem; */
` `
export default function App() { export default function App() {
return ( return (
<> <>
<Suspense fallback={null}> <Suspense fallback={null}>
<AppWrapper>
<HeaderWrapper> <HeaderWrapper>
<Header /> <Header />
</HeaderWrapper> </HeaderWrapper>
...@@ -88,6 +105,10 @@ export default function App() { ...@@ -88,6 +105,10 @@ export default function App() {
</Web3ReactManager> </Web3ReactManager>
</Body> </Body>
</BodyWrapper> </BodyWrapper>
<FooterWrapper>
<Footer />
</FooterWrapper>
</AppWrapper>
</Suspense> </Suspense>
</> </>
) )
......
...@@ -93,8 +93,17 @@ export const GlobalStyle = createGlobalStyle` ...@@ -93,8 +93,17 @@ export const GlobalStyle = createGlobalStyle`
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
} }
body > div {
height: 100%;
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
html { html {
font-size: 16px; font-size: 16px;
font-variant: none; font-variant: none;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment