Skip to content

Commit a6def6f

Browse files
authored
Merge pull request #14891 from ethereum/dapp-categories
fix: dapp category buttons
2 parents 2430915 + 7793e90 commit a6def6f

File tree

1 file changed

+19
-39
lines changed

1 file changed

+19
-39
lines changed

src/pages/[locale]/dapps.tsx

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -129,38 +129,6 @@ const Content = (props: ChildOnlyProp) => (
129129
<div className="w-full px-8 py-4" {...props} />
130130
)
131131

132-
const OptionContainer = (props: ChildOnlyProp) => (
133-
<Flex
134-
className="mb-8 w-full flex-col justify-center px-8 lg:w-auto lg:flex-row"
135-
{...props}
136-
/>
137-
)
138-
139-
const Option = (
140-
props: Pick<ButtonProps, "children" | "onClick"> & { isActive: boolean }
141-
) => {
142-
return (
143-
<Button
144-
variant="outline"
145-
className={cn(
146-
`my-2 flex w-full items-center justify-center rounded-4xl border px-6 py-4 transition-none lg:mx-2 lg:w-auto lg:justify-start ${
147-
props.isActive
148-
? "border-primary text-primary shadow-table-box"
149-
: "border-body text-body"
150-
} hover:border-primary hover:text-primary active:bg-transparent`
151-
)}
152-
{...props}
153-
/>
154-
)
155-
}
156-
157-
const OptionText = (props: ChildOnlyProp) => (
158-
<span
159-
className="text-center text-md font-semibold md:text-2xl md:font-normal"
160-
{...props}
161-
/>
162-
)
163-
164132
const ButtonPrimary = (props: Pick<ButtonProps, "children" | "onClick">) => (
165133
<Button {...props} />
166134
)
@@ -1339,14 +1307,21 @@ const DappsPage = () => {
13391307
<H2 id="explore">{t("page-dapps-explore-dapps-title")}</H2>
13401308
<CenterText>{t("page-dapps-explore-dapps-description")}</CenterText>
13411309
<H3>{t("page-dapps-choose-category")}</H3>
1342-
<OptionContainer>
1310+
<div className="mb-8 grid w-full grid-cols-1 justify-center gap-4 px-8 sm:grid-cols-2 lg:w-auto lg:grid-cols-3 2xl:grid-cols-6">
13431311
{categoryKeys.map((key, idx) => {
13441312
const categoryType = key as CategoryType
13451313
const category = categories[categoryType]
13461314
return (
1347-
<Option
1315+
<Button
13481316
key={idx}
1349-
isActive={selectedCategory === categoryType}
1317+
variant="outline"
1318+
className={cn(
1319+
"flex items-center justify-center rounded-4xl border px-6 py-4 transition-none lg:justify-start",
1320+
selectedCategory === categoryType
1321+
? "border-primary text-primary shadow-table-box"
1322+
: "border-body text-body",
1323+
"hover:border-primary hover:text-primary active:bg-transparent"
1324+
)}
13501325
onClick={() => {
13511326
handleCategorySelect(categoryType, false)
13521327
trackCustomEvent({
@@ -1356,12 +1331,17 @@ const DappsPage = () => {
13561331
})
13571332
}}
13581333
>
1359-
<Emoji className="me-4 text-2xl" text={category.emoji} />
1360-
<OptionText>{category.title}</OptionText>
1361-
</Option>
1334+
<Emoji
1335+
className="me-4 shrink-0 text-2xl"
1336+
text={category.emoji}
1337+
/>
1338+
<span className="text-center text-md font-semibold md:text-2xl md:font-normal">
1339+
{category.title}
1340+
</span>
1341+
</Button>
13621342
)
13631343
})}
1364-
</OptionContainer>
1344+
</div>
13651345
{/* Category-specific content */}
13661346
{selectedCategory === CategoryType.FINANCE && (
13671347
<Content>

0 commit comments

Comments
 (0)