Skip to content

Commit

Permalink
feat: multichain-banner (#9449)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to add a `MultiChainBanner` component and update
translations and banners for a PancakeSwap Multichain Celebration.

### Detailed summary
- Added `MultiChainBanner` component
- Updated translations and banners for Multichain Celebration
- Added new banner components and configurations

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
ChefJerry authored Mar 29, 2024
1 parent ad2f8e6 commit d00abef
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-donuts-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pancakeswap/widgets-internal': patch
---

Added BannerDesc Component.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"LINEA",
"Merkl",
"multicall",
"Multichain",
"OPBNB",
"pancakeswap",
"preinstall",
Expand Down
60 changes: 60 additions & 0 deletions apps/web/src/views/Home/components/Banners/MultichainBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { useTranslation } from '@pancakeswap/localization'
import { ArrowForwardIcon, Flex, useMatchBreakpoints } from '@pancakeswap/uikit'
import {
BackgroundGraphic,
BannerActionContainer,
BannerContainer,
BannerDesc,
BannerGraphics,
BannerMain,
BannerTitle,
GraphicDetail,
LinkExternalAction,
PancakeSwapBadge,
} from '@pancakeswap/widgets-internal'
import { ASSET_CDN } from 'config/constants/endpoints'

const bgMobile = `${ASSET_CDN}/web/banners/multichain/bg-mobile.png`
const bgDesktop = `${ASSET_CDN}/web/banners/multichain/bg-desktop.png`

const bgSmVariant: GraphicDetail = {
src: bgMobile,
width: 272,
height: 224,
}

const bgXsVariant: GraphicDetail = {
src: bgMobile,
width: 218,
height: 182,
}

const participateLink = 'https://app.questn.com/PancakeSwap'

export const MultiChainBanner = () => {
const { t } = useTranslation()
const { isMobile } = useMatchBreakpoints()

const participateAction = (
<LinkExternalAction href={participateLink} color="white" showExternalIcon={false}>
<Flex alignItems="center" style={{ whiteSpace: 'nowrap' }}>
{t('Participate Now')}
<ArrowForwardIcon color="white" ml="4px" />
</Flex>
</LinkExternalAction>
)

return (
<BannerContainer background="radial-gradient(338.53% 307.7% at 0% -37.33%, #5C6BB4 0%, #5AE1EC 100%)">
<BannerMain
badges={<PancakeSwapBadge whiteText />}
title={<BannerTitle variant="orange">{t('PancakeSwap Multichain Celebration')}</BannerTitle>}
desc={isMobile ? null : <BannerDesc color="white">{t('Starting MAR 14 - Over $3500 in prizes!')}</BannerDesc>}
actions={<BannerActionContainer>{participateAction}</BannerActionContainer>}
/>
<BannerGraphics>
<BackgroundGraphic src={bgDesktop} width={468} height={224} sm={bgSmVariant} xs={bgXsVariant} />
</BannerGraphics>
</BannerContainer>
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Trans, useTranslation } from '@pancakeswap/localization'
import { useTranslation } from '@pancakeswap/localization'
import { ArrowForwardIcon, Flex, Text } from '@pancakeswap/uikit'
import {
BackgroundGraphic,
Expand Down Expand Up @@ -49,14 +49,6 @@ const VerticalDivider = styled.span`
margin: auto 8px;
`

const Desc = () => {
return (
<BannerDesc>
<Trans>$5,000 extra reward pool</Trans>
</BannerDesc>
)
}

const Floating = styled(FloatingGraphic)`
left: 3%;
top: 10%;
Expand Down Expand Up @@ -135,7 +127,7 @@ export function WBNBFixedStakingBanner() {
{isMobile ? t('Stake WBNB, Win Combo Rewards!') : t('Stake WBNB to Win Combo Rewards')}
</BannerTitle>
}
desc={isMobile ? null : <Desc />}
desc={isMobile ? null : <BannerDesc>{t('$5,000 extra reward pool')}</BannerDesc>}
actions={
<BannerActionContainer>
{stakeAction}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ReactElement, useMemo } from 'react'
import CompetitionBanner from '../CompetitionBanner'
import { GalxeTraverseBanner } from '../GalxeTraverseBanner'
import GameBanner from '../GameBanner'
import { MultiChainBanner } from '../MultichainBanner'
import { NemesisDownfallBanner } from '../NemesisDownfallBanner'
import NewIFOBanner from '../NewIFOBanner'
import PerpetualBanner from '../PerpetualBanner'
Expand Down Expand Up @@ -47,6 +48,10 @@ export const useMultipleBannerConfig = () => {
banner: <UserBanner />,
},
{ shouldRender: isRenderIFOBanner || Boolean(countdown), banner: <NewIFOBanner /> },
{
shouldRender: true,
banner: <MultiChainBanner />,
},
{
shouldRender: true,
banner: <WBNBFixedStakingBanner />,
Expand Down
6 changes: 5 additions & 1 deletion packages/localization/src/config/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -3268,5 +3268,9 @@
"Registration Error": "Registration Error",
"Stake your WBNB here": "Stake your WBNB here",
"Stake WBNB, Win Combo Rewards!": "Stake WBNB, Win Combo Rewards!",
"Stake WBNB to Win Combo Rewards": "Stake WBNB to Win Combo Rewards"
"Stake WBNB to Win Combo Rewards": "Stake WBNB to Win Combo Rewards",
"$5,000 extra reward pool": "$5,000 extra reward pool",
"PancakeSwap Multichain Celebration": "PancakeSwap Multichain Celebration",
"Starting MAR 14 - Over $3500 in prizes!": "Starting MAR 14 - Over $3500 in prizes!",
"Participate Now": "Participate Now"
}
13 changes: 13 additions & 0 deletions packages/widgets-internal/components/Banner/BannerDesc.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Text } from "@pancakeswap/uikit";
import styled from "styled-components";

export const BannerDesc = styled(Text)`
font-size: 14px;
font-weight: 600;
line-height: 120%;
${({ theme }) => theme.mediaQueries.sm} {
font-size: 16px;
white-space: nowrap;
}
`;
1 change: 1 addition & 0 deletions packages/widgets-internal/components/Banner/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from "./BannerActionContainer";
export * from "./BannerContainer";
export * from "./BannerDesc";
export * from "./BannerGraphics";
export * from "./BannerMain";
export * from "./BannerTitle";
Expand Down

0 comments on commit d00abef

Please sign in to comment.