Skip to content

Commit 84a34c6

Browse files
authored
Migrate PlatformSelect to tailwind (#1716)
* Migrate PlatformSelect to tailwind * biome
1 parent 5cd65c0 commit 84a34c6

File tree

2 files changed

+44
-89
lines changed

2 files changed

+44
-89
lines changed

frontend/src/components/PlatformSelect/PlatformSelect.module.scss

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import clsx from "clsx";
2-
31
import { PlatformIcon } from "./PlatformIcon";
4-
import styles from "./PlatformSelect.module.scss";
2+
import clsx from "clsx";
53

64
export type Props = {
75
platforms: {
@@ -22,26 +20,50 @@ export default function PlatformSelect({
2220
className,
2321
}: Props) {
2422
return (
25-
<ul className={clsx(styles.container, className)}>
26-
{Object.entries(platforms).map(([key, platform]) => (
27-
<li
28-
key={key}
29-
className={clsx(styles.platform, {
30-
[styles.selected]: value === key,
31-
})}
32-
onClick={() => onChange(key)}
33-
>
34-
<PlatformIcon clickable={false} platform={key} />
35-
<div className={styles.labelContainer}>
36-
<div className={styles.consoleName}>
37-
{platform.name}
38-
</div>
39-
<div className={styles.platformName}>
40-
{platform.description}
23+
<ul
24+
className={clsx(
25+
"grid list-none grid-cols-2 gap-2 md:grid-cols-3",
26+
className,
27+
)}
28+
>
29+
{Object.entries(platforms).map(([key, platform]) => {
30+
const isSelected = value === key;
31+
32+
return (
33+
<li
34+
key={key}
35+
onClick={() => onChange(key)}
36+
className={clsx(
37+
"flex cursor-pointer select-none items-center gap-3 rounded-md p-3 transition-colors",
38+
"border-[var(--g400)] bg-[var(--g300)] text-[var(--g2000)]",
39+
"text-var(--g1200) hover:text-[var(--g2000)]",
40+
"bg-transparent",
41+
"group",
42+
{
43+
"border-[var(--g400)] bg-[var(--g300)] text-[var(--g2000)]":
44+
isSelected,
45+
},
46+
)}
47+
>
48+
<PlatformIcon
49+
clickable={false}
50+
platform={key}
51+
className={clsx(
52+
"h-10 w-10 filter transition-filter duration-200",
53+
"grayscale",
54+
"group-hover:grayscale-0",
55+
isSelected && "grayscale-0",
56+
)}
57+
/>
58+
<div className="flex flex-col gap-1">
59+
<div className="font-medium">{platform.name}</div>
60+
<div className="text-xs opacity-60">
61+
{platform.description}
62+
</div>
4163
</div>
42-
</div>
43-
</li>
44-
))}
64+
</li>
65+
);
66+
})}
4567
</ul>
4668
);
4769
}

0 commit comments

Comments
 (0)