Skip to content

Commit bbc3b42

Browse files
committed
refactor: reorganize copy details
1 parent 065a055 commit bbc3b42

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

src/components/Homepage/useBentoBox.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ import MergeImage from "@/public/images/upgrades/merge.png"
1111
type Breakpoint = "mobile" | "lg" | "xl"
1212
type Direction = "down" | "up" | "right" | "left"
1313
type Color = "primary" | "accent-a" | "accent-b" | "accent-c"
14+
type Category = "stablecoins" | "defi" | "dapps" | "networks" | "assets"
15+
type CopyDetails = {
16+
title: string
17+
children: string
18+
action: string
19+
href: string
20+
}
1421

1522
const gradientStops = "from-20% to-60%"
1623

@@ -88,47 +95,39 @@ const getPosition = (position: number): string =>
8895
export const useBentoBox = () => {
8996
const { t } = useTranslation("page-index")
9097

98+
const getCopy = (category: Category, href: string): CopyDetails => ({
99+
title: t(`page-index:page-index-bento-${category}-title`),
100+
children: t(`page-index:page-index-bento-${category}-content`),
101+
action: t(`page-index:page-index-bento-${category}-action`),
102+
href,
103+
})
104+
91105
return [
92106
{
93-
title: t("page-index-bento-stablecoins-title"),
94-
children: t("page-index:page-index-bento-stablecoins-content"),
95-
action: t("page-index:page-index-bento-stablecoins-action"),
96-
href: "/stablecoins/",
107+
...getCopy("stablecoins", "/stablecoins/"),
97108
imgSrc: ImpactImage,
98109
imgWidth: 400,
99110
className: cn(colorOptions["primary"], getPosition(0)),
100111
},
101112
{
102-
title: t("page-index:page-index-bento-defi-title"),
103-
children: t("page-index:page-index-bento-defi-content"),
104-
action: t("page-index:page-index-bento-defi-action"),
105-
href: "/defi/",
113+
...getCopy("defi", "/defi/"),
106114
imgSrc: ManAndDogImage,
107115
className: cn(colorOptions["accent-c"], getPosition(1)),
108116
},
109117
{
110-
title: t("page-index:page-index-bento-dapps-title"),
111-
children: t("page-index:page-index-bento-dapps-content"),
112-
action: t("page-index:page-index-bento-dapps-action"),
113-
href: "/dapps/",
118+
...getCopy("dapps", "/dapps/"),
114119
imgSrc: MergeImage,
115120
imgWidth: 320,
116121
className: cn(colorOptions["accent-b"], getPosition(2)),
117122
},
118123
{
119-
title: t("page-index:page-index-bento-networks-title"),
120-
children: t("page-index:page-index-bento-networks-content"),
121-
action: t("page-index:page-index-bento-networks-action"),
122-
href: "/layer-2/",
124+
...getCopy("networks", "/layer-2/"),
123125
imgSrc: ManBabyWomanImage,
124126
imgWidth: 324,
125127
className: cn(colorOptions["accent-a"], getPosition(3)),
126128
},
127129
{
128-
title: t("page-index:page-index-bento-assets-title"),
129-
children: t("page-index:page-index-bento-assets-content"),
130-
action: t("page-index:page-index-bento-assets-action"),
131-
href: "/nft/",
130+
...getCopy("assets", "/nft/"),
132131
imgSrc: RobotBarImage,
133132
imgWidth: 324,
134133
className: cn(colorOptions["primary"], getPosition(4)),

0 commit comments

Comments
 (0)