Skip to content

Commit d016076

Browse files
committed
feat: turn links into buttons
1 parent b921629 commit d016076

2 files changed

Lines changed: 37 additions & 28 deletions

File tree

src/components/categories/category-icons/category-icons.module.css

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,29 @@
1818
align-items: center;
1919
justify-content: center;
2020

21-
& a {
22-
color: inherit;
23-
text-decoration: none;
21+
& .icon {
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
width: 48px;
26+
height: 48px;
27+
font-size: var(--font-md);
28+
color: var(--color-foreground);
29+
cursor: pointer;
30+
background: linear-gradient(
31+
var(--color-neutral-50),
32+
var(--color-neutral-100)
33+
);
34+
border: 1px solid var(--color-neutral-300);
35+
border-radius: 50%;
36+
transition: 0.2s;
2437

25-
& .icon {
26-
display: flex;
27-
align-items: center;
28-
justify-content: center;
29-
width: 48px;
30-
height: 48px;
31-
font-size: var(--font-md);
38+
&:hover {
3239
background: linear-gradient(
33-
var(--color-neutral-50),
34-
var(--color-neutral-100)
40+
var(--color-neutral-100),
41+
var(--color-neutral-200)
3542
);
36-
border: 1px solid var(--color-neutral-300);
37-
border-radius: 50%;
38-
transition: 0.2s;
39-
40-
&:hover {
41-
background: linear-gradient(
42-
var(--color-neutral-100),
43-
var(--color-neutral-200)
44-
);
45-
transform: scale(1.15);
46-
}
43+
transform: scale(1.15);
4744
}
4845
}
4946
}

src/components/categories/category-icons/category-icons.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import { Tooltip } from '@/components/tooltip';
77
export default function CategoryIcons() {
88
const categories = useMemo(() => sounds.categories, []);
99

10+
const goto = (id: string) => {
11+
const category = document.getElementById(`category-${id}`);
12+
category?.scrollIntoView();
13+
};
14+
1015
return (
1116
<Container>
1217
<div className={styles.wrapper}>
@@ -15,11 +20,18 @@ export default function CategoryIcons() {
1520
<Tooltip.Provider delayDuration={0}>
1621
{categories.map(category => {
1722
return (
18-
<a href={`#category-${category.id}`} key={category.id}>
19-
<Tooltip content={category.title} placement="bottom">
20-
<div className={styles.icon}>{category.icon}</div>
21-
</Tooltip>
22-
</a>
23+
<Tooltip
24+
content={category.title}
25+
key={category.id}
26+
placement="bottom"
27+
>
28+
<button
29+
className={styles.icon}
30+
onClick={() => goto(category.id)}
31+
>
32+
{category.icon}
33+
</button>
34+
</Tooltip>
2335
);
2436
})}
2537
</Tooltip.Provider>

0 commit comments

Comments
 (0)