Skip to content

Commit 5bf2767

Browse files
committed
feat: add icons to nav bar
1 parent 4c2390c commit 5bf2767

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/pages/[locale]/resources.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ const ResourcesPage = ({ txCostsMedianUsd }) => {
119119
{t("page-resources-whats-on-this-page")}
120120
</div>
121121
<nav className="mx-4 flex max-w-full gap-1 overflow-x-auto bg-background p-2 shadow md:max-w-[calc(100%-2rem)] md:rounded-2xl md:border md:p-0.5 md:shadow-lg">
122-
{resourceSections.map(({ key, title }) => (
122+
{resourceSections.map(({ key, title, icon }) => (
123123
<ButtonLink
124124
key={key}
125125
href={`#${key}`}
126126
variant="ghost"
127127
isSecondary
128128
className={cn(
129-
"relative text-nowrap rounded-xl px-4 py-2 text-sm",
129+
"relative text-nowrap rounded-xl px-4 py-2 text-sm [&_svg]:shrink-0 [&_svg]:text-sm",
130130
activeSection === key && "!text-primary"
131131
)}
132132
>
@@ -136,19 +136,20 @@ const ResourcesPage = ({ txCostsMedianUsd }) => {
136136
className="absolute inset-0 z-0 rounded-xl bg-primary-low-contrast"
137137
/>
138138
)}
139+
{icon && <span className="z-10 text-lg">{icon}</span>}
139140
<span className="relative z-10">{title}</span>
140141
</ButtonLink>
141142
))}
142143
</nav>
143144
</div>
144145

145-
{resourceSections.map(({ key, icon, title, boxes }) => (
146+
{resourceSections.map(({ key, icon, title: sectionTitle, boxes }) => (
146147
<section id={key} key={key} className="mb-16 scroll-mt-40">
147148
<div className="group flex w-full items-center gap-3 border-b bg-transparent px-4 py-6">
148-
<div className="grid size-12 place-items-center rounded-lg border border-border-low-contrast text-2xl">
149+
<div className="grid size-12 place-items-center rounded-lg border border-border-low-contrast text-2xl [&_svg]:shrink-0">
149150
{icon || <StackIcon />}
150151
</div>
151-
<h2 className="flex-1 text-start font-black">{title}</h2>
152+
<h2 className="flex-1 text-start font-black">{sectionTitle}</h2>
152153
</div>
153154
<div className="grid grid-cols-1 gap-8 px-4 pb-12 pt-8 md:pb-12 md:pt-8 lg:grid-cols-2">
154155
{boxes.map(({ title, metric, items, className }) => (

0 commit comments

Comments
 (0)