Skip to content

Commit

Permalink
Sky Upgrade page banner update (#4033)
Browse files Browse the repository at this point in the history
* Refactor ActionBanner component to support multiple CTAs
Use multiple CTAs on the upgrade banner

* Update Sky and Sky related logos/icons
  • Loading branch information
marcinciarka authored Sep 25, 2024
1 parent 9f35ef2 commit 357efe0
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 47 deletions.
95 changes: 61 additions & 34 deletions components/ActionBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ interface ActionBannerWithImage {
icon?: never
image?: string
}
type CtaType = {
label: string
onClick?: () => void
targetBlank?: boolean
url?: string
}

export type ActionBannerType = {
closingSaveKey?: string
cta?: {
label: string
onClick?: () => void
targetBlank?: boolean
url?: string
}
cta?: CtaType | CtaType[]
sx?: ThemeUIStyleObject
title: string
withClose?: boolean
Expand All @@ -38,6 +39,59 @@ function getSessionStorageKey(suffix: string): string {
return `action-banner-${kebabCase(suffix)}`
}

const CtaComponent = ({
cta,
customCtaVariant,
lightText,
}: {
cta: ActionBannerProps['cta']
customCtaVariant: ActionBannerProps['customCtaVariant']
lightText: ActionBannerProps['lightText']
}) => {
if (Array.isArray(cta)) {
return (
<>
{cta.map((ctaItem, index) => (
<CtaComponent
key={`CtaItem_${ctaItem.label}_${ctaItem.url}_${index}`}
cta={ctaItem}
lightText={lightText}
customCtaVariant={customCtaVariant}
/>
))}
</>
)
}
return cta ? (
<Box sx={{ flexShrink: 0, ml: 'auto' }}>
{cta.url ? (
<AppLink
href={cta.url}
internalInNewTab={cta.targetBlank}
{...(cta.onClick && { onClick: cta.onClick })}
>
<Button
variant={customCtaVariant ?? 'action'}
sx={{ color: lightText ? 'neutral10' : undefined }}
>
{cta.label}
</Button>
</AppLink>
) : (
cta.onClick && (
<Button
variant={customCtaVariant ?? 'action'}
sx={{ color: lightText ? 'neutral10' : undefined }}
onClick={cta.onClick}
>
{cta.label}
</Button>
)
)}
</Box>
) : null
}

export function ActionBanner({
closingSaveKey,
children,
Expand Down Expand Up @@ -87,34 +141,7 @@ export function ActionBanner({
</Text>
)}
</Flex>
{cta && (
<Box sx={{ flexShrink: 0, ml: 'auto' }}>
{cta.url ? (
<AppLink
href={cta.url}
internalInNewTab={cta.targetBlank}
{...(cta.onClick && { onClick: cta.onClick })}
>
<Button
variant={customCtaVariant ?? 'action'}
sx={{ color: lightText ? 'neutral10' : undefined }}
>
{cta.label}
</Button>
</AppLink>
) : (
cta.onClick && (
<Button
variant={customCtaVariant ?? 'action'}
sx={{ color: lightText ? 'neutral10' : undefined }}
onClick={cta.onClick}
>
{cta.label}
</Button>
)
)}
</Box>
)}
{cta && <CtaComponent cta={cta} lightText={lightText} customCtaVariant={customCtaVariant} />}
{withClose && (
<Button
variant="unStyled"
Expand Down
8 changes: 4 additions & 4 deletions features/homepage/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export const partnerLogosConfig: ImagesSliderProps['items'] = [
height: '30px',
},
{
imgSrc: staticFilesRuntimeUrl('/static/img/homepage/slider/maker.svg'),
imgAlt: 'Maker',
imgSrc: staticFilesRuntimeUrl('/static/img/homepage/slider/sky.svg'),
imgAlt: 'Sky',
url: '',
width: '242px',
height: '100px',
width: '110px',
height: '38px',
},
{
imgSrc: staticFilesRuntimeUrl('/static/img/homepage/slider/spark.svg'),
Expand Down
3 changes: 2 additions & 1 deletion lendingProtocols/lendingProtocolsConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import makerLogo from 'public/static/img/protocol_icons/maker_logo.svg'
import morphoBlueIcon from 'public/static/img/protocol_icons/morpho_blue_icon.svg'
import morphoBlueLogo from 'public/static/img/protocol_icons/morpho_blue_logo.svg'
import skyIcon from 'public/static/img/protocol_icons/sky.svg'
import skyLogo from 'public/static/img/protocol_icons/sky_logo.svg'
import sparkIcon from 'public/static/img/protocol_icons/spark_icon.svg'
import sparkLogo from 'public/static/img/protocol_icons/spark_logo.svg'

Expand Down Expand Up @@ -80,7 +81,7 @@ const skyConfig: LendingProtocolConfig = {
name: LendingProtocol.Sky,
label: LendingProtocolLabel.sky,
icon: skyIcon as string,
logo: skyIcon as string,
logo: skyLogo as string,
logoScale: 1.6,
gradient: 'linear-gradient(159deg, #4a87fa 12.26%, #a294ee 86.52%)',
}
Expand Down
19 changes: 13 additions & 6 deletions pages/[networkOrProduct]/sky/upgrade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,19 @@ function SkySwapWrapper() {
<>
{balancesData?.[0] && balancesData[0].isGreaterThan(zero) && (
<ActionBanner
title={`You have ${formatAsShorthandNumbers(balancesData[0])} USDS ready to be staked`}
title={`You have ${formatAsShorthandNumbers(balancesData[0])} USDS that can earn SKY or Chronicle Points`}
lightText
customCtaVariant="outlineSmall"
cta={{
label: 'Stake now',
url: `/earn/srr/${wallet?.accounts[0].address}`,
}}
cta={[
{
label: 'Get SKY Rewards',
url: `/earn/srr/${wallet?.accounts[0].address}`,
},
{
label: 'Earn Chronicle Points',
url: `/earn/cle/${wallet?.accounts[0].address}`,
},
]}
sx={{
backgroundImage: `url(${staticFilesRuntimeUrl('/static/img/sky-banner-background.png')})`,
backgroundSize: 'cover',
Expand All @@ -92,7 +98,8 @@ function SkySwapWrapper() {
my: 4,
}}
>
Stake your USDS in the Sky Ecosystem to earn SKY rewards.
Deposit you USDS in the SKY Ecosystem to earn Chronicle Points or SKY Rewards. Withdraw
anytime.
</ActionBanner>
)}
<Grid gap={3} columns={[1, 3]} mt={[1, 3]}>
Expand Down
17 changes: 17 additions & 0 deletions public/static/img/homepage/slider/sky.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
123 changes: 123 additions & 0 deletions public/static/img/protocol_icons/sky_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions theme/icons/cle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@ import React from 'react'
export const cle = {
path: (
<>
<circle cx="16" cy="16" fill="#2fd05b" r="16" />
<path d="M12.25 7.25l-5 5v7.5h5v5h7.5l5-5V13.5h-5v6.25h-7.5v-7.5h6.25v-5zm0 0" fill="#fff" />
<g clip-path="url(#clip0_15346_4406)">
<path
d="M16 29C23.1797 29 29 23.1797 29 16C29 8.8203 23.1797 3 16 3C8.8203 3 3 8.8203 3 16C3 23.1797 8.8203 29 16 29Z"
fill="#2FD05B"
/>
<path
d="M12.9531 8.89062L8.89062 12.9531V19.0469H12.9531V23.1094H19.0469L23.1094 19.0469V13.9688H19.0469V19.0469H12.9531V12.9531H18.0312V8.89062H12.9531Z"
fill="white"
/>
</g>
<defs>
<clipPath id="clip0_15346_4406">
<rect width="26" height="26" fill="white" transform="translate(3 3)" />
</clipPath>
</defs>
</>
),
viewBox: '0 0 32 32',
Expand Down

0 comments on commit 357efe0

Please sign in to comment.