-
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
9a3b5c8
commit ba47f13
Showing
12 changed files
with
177 additions
and
106 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
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,35 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import { PancakeRoundIcon } from "../../../components/Svg"; | ||
import Text from "../../../components/Text/Text"; | ||
import Skeleton from "../../../components/Skeleton/Skeleton"; | ||
|
||
interface Props { | ||
cakePriceUsd?: number; | ||
} | ||
|
||
const PriceLink = styled.a` | ||
display: flex; | ||
align-items: center; | ||
svg { | ||
transition: transform 0.3s; | ||
} | ||
:hover { | ||
svg { | ||
transform: scale(1.2); | ||
} | ||
} | ||
`; | ||
|
||
const CakePrice: React.FC<Props> = ({ cakePriceUsd }) => { | ||
return cakePriceUsd ? ( | ||
<PriceLink href="https://pancakeswap.info/token/0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82" target="_blank"> | ||
<PancakeRoundIcon width="24px" mr="8px" /> | ||
<Text color="textSubtle" bold>{`$${cakePriceUsd.toFixed(3)}`}</Text> | ||
</PriceLink> | ||
) : ( | ||
<Skeleton width={80} height={24} /> | ||
); | ||
}; | ||
|
||
export default React.memo(CakePrice); |
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,42 @@ | ||
import React from "react"; | ||
import { SvgProps } from "../../../components/Svg"; | ||
import Text from "../../../components/Text/Text"; | ||
import Dropdown from "../../../components/Dropdown/Dropdown"; | ||
import Button from "../../../components/Button/Button"; | ||
import * as IconModule from "../icons"; | ||
import { LangType } from "../types"; | ||
import MenuButton from "./MenuButton"; | ||
|
||
const Icons = (IconModule as unknown) as { [key: string]: React.FC<SvgProps> }; | ||
const { LanguageIcon } = Icons; | ||
|
||
interface Props { | ||
currentLang: string; | ||
langs: LangType[]; | ||
setLang: (lang: LangType) => void; | ||
} | ||
|
||
const LangSelector: React.FC<Props> = ({ currentLang, langs, setLang }) => ( | ||
<Dropdown | ||
position="top-right" | ||
target={ | ||
<Button variant="text" startIcon={<LanguageIcon color="textSubtle" width="24px" />}> | ||
<Text color="textSubtle">{currentLang?.toUpperCase()}</Text> | ||
</Button> | ||
} | ||
> | ||
{langs.map((lang) => ( | ||
<MenuButton | ||
key={lang.code} | ||
fullWidth | ||
onClick={() => setLang(lang)} | ||
// Safari fix | ||
style={{ minHeight: "32px", height: "auto" }} | ||
> | ||
{lang.language} | ||
</MenuButton> | ||
))} | ||
</Dropdown> | ||
); | ||
|
||
export default React.memo(LangSelector, (prev, next) => prev.currentLang === next.currentLang); |
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,37 @@ | ||
import React from "react"; | ||
import { SvgProps } from "../../../components/Svg"; | ||
import Flex from "../../../components/Box/Flex"; | ||
import Dropdown from "../../../components/Dropdown/Dropdown"; | ||
import Link from "../../../components/Link/Link"; | ||
import * as IconModule from "../icons"; | ||
import { socials } from "../config"; | ||
|
||
const Icons = (IconModule as unknown) as { [key: string]: React.FC<SvgProps> }; | ||
|
||
const SocialLinks: React.FC = () => ( | ||
<Flex> | ||
{socials.map((social, index) => { | ||
const Icon = Icons[social.icon]; | ||
const iconProps = { width: "24px", color: "textSubtle", style: { cursor: "pointer" } }; | ||
const mr = index < socials.length - 1 ? "24px" : 0; | ||
if (social.items) { | ||
return ( | ||
<Dropdown key={social.label} position="top" target={<Icon {...iconProps} mr={mr} />}> | ||
{social.items.map((item) => ( | ||
<Link external key={item.label} href={item.href} aria-label={item.label} color="textSubtle"> | ||
{item.label} | ||
</Link> | ||
))} | ||
</Dropdown> | ||
); | ||
} | ||
return ( | ||
<Link external key={social.label} href={social.href} aria-label={social.label} mr={mr}> | ||
<Icon {...iconProps} /> | ||
</Link> | ||
); | ||
})} | ||
</Flex> | ||
); | ||
|
||
export default React.memo(SocialLinks, () => true); |
Oops, something went wrong.