-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49a9c26
commit d8592e6
Showing
13 changed files
with
169 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from "react"; | ||
import Svg from "../Svg"; | ||
import SvgProps from "../types"; | ||
|
||
const Icon: React.FC<SvgProps> = (props) => { | ||
return ( | ||
<Svg viewBox="0 0 24 24" {...props}> | ||
<path d="M8.11997 9.29006L12 13.1701L15.88 9.29006C16.27 8.90006 16.9 8.90006 17.29 9.29006C17.68 9.68006 17.68 10.3101 17.29 10.7001L12.7 15.2901C12.31 15.6801 11.68 15.6801 11.29 15.2901L6.69997 10.7001C6.30997 10.3101 6.30997 9.68006 6.69997 9.29006C7.08997 8.91006 7.72997 8.90006 8.11997 9.29006Z" /> | ||
</Svg> | ||
); | ||
}; | ||
|
||
export default Icon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { useState } from "react"; | ||
import styled from "styled-components"; | ||
|
||
interface Props { | ||
target: React.ReactElement; | ||
} | ||
|
||
const DropdownContent = styled.div<{ isOpen: boolean }>` | ||
display: ${({ isOpen }) => (isOpen ? "flex" : "none")}; | ||
flex-direction: column; | ||
padding-left: 8px; | ||
${({ theme }) => theme.mediaQueries.nav} { | ||
padding-left: 0; | ||
display: none; | ||
position: absolute; | ||
left: 50%; | ||
transform: translate(-50%, 0); | ||
background-color: ${({ theme }) => theme.nav.background}; | ||
box-shadow: ${({ theme }) => theme.shadows.level1}; | ||
border-radius: ${({ theme }) => theme.radii.small}; | ||
max-height: 500px; | ||
overflow-y: auto; | ||
z-index: ${({ theme }) => theme.zIndices.modal}; | ||
} | ||
`; | ||
|
||
const Container = styled.div` | ||
width: 100%; | ||
position: relative; | ||
${({ theme }) => theme.mediaQueries.nav} { | ||
width: fit-content; | ||
height: 100%; | ||
&:hover ${DropdownContent}, &:focus-within ${DropdownContent} { | ||
display: flex; | ||
} | ||
} | ||
`; | ||
|
||
const Dropdown: React.FC<Props> = ({ target, children }) => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
return ( | ||
<Container onClick={() => setIsOpen((prevState) => !prevState)}> | ||
{target} | ||
<DropdownContent isOpen={isOpen}>{children}</DropdownContent> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Dropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import { LogoRoundIcon } from "../../components/Svg"; | ||
import Text from "../../components/Text"; | ||
|
||
const Container = styled.a` | ||
display: flex; | ||
align-items: center; | ||
margin-right: 4px; | ||
svg { | ||
transition: transform 0.3s; | ||
} | ||
:hover { | ||
svg { | ||
transform: scale(1.2); | ||
} | ||
} | ||
`; | ||
|
||
const PancakePrice: React.FC<{ cakePriceUsd?: number }> = ({ cakePriceUsd }) => { | ||
return cakePriceUsd ? ( | ||
<Container href="https://pancakeswap.info/token/0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"> | ||
<LogoRoundIcon mr="4px" /> | ||
<Text bold>{`$${cakePriceUsd.toFixed(3)}`}</Text> | ||
</Container> | ||
) : null; | ||
}; | ||
|
||
export default PancakePrice; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters