-
Notifications
You must be signed in to change notification settings - Fork 39
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
a0cf1e9
commit 8f45b66
Showing
2 changed files
with
104 additions
and
50 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 |
---|---|---|
@@ -1,30 +1,117 @@ | ||
import { makeStyles } from "@material-ui/core"; | ||
import React from "react"; | ||
import MuiLink from "@material-ui/core/Link"; | ||
import { Typography, makeStyles } from "@material-ui/core"; | ||
import { useMemo } from "react"; | ||
import { Theme } from "@near-wallet-selector/modal-ui"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
const useStyles = makeStyles<Theme, { changeWindowPassDue: boolean }>(() => ({ | ||
bar: { | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
width: "100%", | ||
minHeight: "48px", | ||
padding: "4px 16px", | ||
height: "56px", | ||
textAlign: "center", | ||
fontWeight: 500, | ||
fontSize: "14px", | ||
fontSize: "16px", | ||
letterSpacing: "0.02em", | ||
background: "linear-gradient(20deg, #f44b1b 0%, #eeb430 100%);", | ||
background: ({ changeWindowPassDue }) => | ||
changeWindowPassDue | ||
? "linear-gradient(1deg, #9577F4 0%, #AD55DA 28.96%, #CA2EBD 100%);" | ||
: "linear-gradient(20deg, #f44b1b 0%, #eeb430 100%);", | ||
}, | ||
bannerLink: { | ||
display: "inline-flex", | ||
alignItems: "center", | ||
borderRadius: 20, | ||
padding: "6px 12px", | ||
backgroundColor: "white", | ||
color: ({ changeWindowPassDue }) => (changeWindowPassDue ? "#17153F" : "#F47B48"), | ||
marginLeft: "8px", | ||
fontSize: "12px", | ||
letterSpacing: "0.08em", | ||
fontWeight: 600, | ||
minHeight: "32px", | ||
minWidth: "fit-content", | ||
fontFamily: 'Poppins', | ||
wordWrap: 'break-word' | ||
}, | ||
})); | ||
interface LinkProps { | ||
href: string; | ||
className: string; | ||
} | ||
|
||
type Props = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
const NewsBar = ({ children }: Props) => { | ||
const classes = useStyles(); | ||
function Link({ href, className }: LinkProps) { | ||
return ( | ||
<MuiLink | ||
href={href} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
color="inherit" | ||
className={className} | ||
> | ||
TRY IT NOW | ||
</MuiLink> | ||
); | ||
} | ||
|
||
return <div className={classes.bar}>{children}</div>; | ||
const messages = { | ||
cctp: { | ||
href: "https://portalbridge.com/usdc-bridge", | ||
// To show Optimism option on SEPT 4th 2023 | ||
content: | ||
new Date() < new Date(2023, 8, 4) | ||
? "Experience frictionless USDC transfers between Ethereum, Avalanche, and Arbitrum with Circle's CCTP. " | ||
: "Experience frictionless USDC transfers between Ethereum, Avalanche, Arbitrum, and Optimism with Circle's CCTP.", | ||
}, | ||
cosmos: { | ||
href: "https://portalbridge.com/cosmos", | ||
content: ( | ||
<> | ||
<Typography | ||
variant="body1" | ||
style={{ | ||
color: "white", | ||
fontSize: 16, | ||
fontFamily: "Poppins", | ||
fontWeight: 500, | ||
lineHeight: 20.02, | ||
letterSpacing: 0.28, | ||
wordWrap: "break-word", | ||
}} | ||
> | ||
Wormhole Gateway is now live on mainnet! | ||
</Typography> | ||
<Typography | ||
variant="body1" | ||
style={{ | ||
color: "white", | ||
fontSize: 16, | ||
fontFamily: "Poppins", | ||
fontWeight: 700, | ||
lineHeight: 20.02, | ||
letterSpacing: 0.28, | ||
wordWrap: "break-word", | ||
}} | ||
> | ||
Bridge your assets to Osmosis today. | ||
</Typography> | ||
</> | ||
), | ||
}, | ||
}; | ||
|
||
export default NewsBar; | ||
export default function NewsBar() { | ||
const changeWindowPassDue = useMemo(() => new Date() < new Date(2023, 8, 4), []); | ||
const classes = useStyles({ changeWindowPassDue }); | ||
const { content, href } = useMemo( | ||
() => (changeWindowPassDue ? messages.cosmos : messages.cctp), | ||
[changeWindowPassDue] | ||
); | ||
return ( | ||
<div className={classes.bar}> | ||
{content} | ||
<Link href={href} className={classes.bannerLink} /> | ||
</div> | ||
); | ||
}; |