@@ -11,6 +11,13 @@ import MergeImage from "@/public/images/upgrades/merge.png"
11
11
type Breakpoint = "mobile" | "lg" | "xl"
12
12
type Direction = "down" | "up" | "right" | "left"
13
13
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
+ }
14
21
15
22
const gradientStops = "from-20% to-60%"
16
23
@@ -88,47 +95,39 @@ const getPosition = (position: number): string =>
88
95
export const useBentoBox = ( ) => {
89
96
const { t } = useTranslation ( "page-index" )
90
97
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
+
91
105
return [
92
106
{
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/" ,
97
- imgSrc : ImpactImage ,
98
- imgWidth : 400 ,
107
+ ...getCopy ( "stablecoins" , "/stablecoins/" ) ,
108
+ imgSrc : ManAndDogImage ,
99
109
className : cn ( colorOptions [ "primary" ] , getPosition ( 0 ) ) ,
100
110
} ,
101
111
{
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/" ,
106
- imgSrc : ManAndDogImage ,
112
+ ...getCopy ( "defi" , "/defi/" ) ,
113
+ imgSrc : ImpactImage ,
114
+ imgWidth : 400 ,
107
115
className : cn ( colorOptions [ "accent-c" ] , getPosition ( 1 ) ) ,
108
116
} ,
109
117
{
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 ( "networks" , "/layer-2/" ) ,
114
119
imgSrc : MergeImage ,
115
120
imgWidth : 320 ,
116
121
className : cn ( colorOptions [ "accent-b" ] , getPosition ( 2 ) ) ,
117
122
} ,
118
123
{
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 ( "dapps" , "/dapps/" ) ,
123
125
imgSrc : ManBabyWomanImage ,
124
126
imgWidth : 324 ,
125
127
className : cn ( colorOptions [ "accent-a" ] , getPosition ( 3 ) ) ,
126
128
} ,
127
129
{
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/" ) ,
132
131
imgSrc : RobotBarImage ,
133
132
imgWidth : 324 ,
134
133
className : cn ( colorOptions [ "primary" ] , getPosition ( 4 ) ) ,
0 commit comments