Skip to content

Commit 5108f17

Browse files
committed
docs(Icons): remove Slider
1 parent d318262 commit 5108f17

File tree

1 file changed

+15
-40
lines changed

1 file changed

+15
-40
lines changed

packages/storybook/src/icons/icons.stories.tsx

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable react-hooks/rules-of-hooks */
22
import * as Icons from "@qlik/sprout-icons/react";
3-
import { classNames, Slider, TextField } from "@qlik/sprout-react";
3+
import { classNames, Select, TextField } from "@qlik/sprout-react";
44
import type { Meta } from "@storybook/react";
55
import { useState } from "react";
66

@@ -10,38 +10,12 @@ const meta: Meta = {
1010

1111
export default meta;
1212

13-
const SIZES: Record<number, string> = {
14-
1: "s",
15-
2: "m",
16-
3: "l",
17-
4: "xl",
18-
5: "xxl",
19-
6: "2xl",
20-
7: "3xl",
21-
8: "4xl",
22-
9: "5xl",
23-
10: "6xl",
24-
11: "7xl",
25-
};
26-
27-
const Marks: Array<{ value: keyof typeof SIZES; label: string }> = [
28-
{ value: 1, label: "s" },
29-
{ value: 2, label: "m" },
30-
{ value: 3, label: "l" },
31-
{ value: 4, label: "xl" },
32-
{ value: 5, label: "xxl" },
33-
{ value: 6, label: "2xl" },
34-
{ value: 7, label: "3xl" },
35-
{ value: 8, label: "4xl" },
36-
{ value: 9, label: "5xl" },
37-
{ value: 10, label: "6xl" },
38-
{ value: 11, label: "7xl" },
39-
];
13+
const SIZES = ["s", "m", "l", "xl", "xxl", "2xl", "3xl", "4xl", "5xl", "6xl", "7xl"] as const;
4014

4115
export const AllIcons = {
4216
render: () => {
4317
const [search, setSearch] = useState("");
44-
const [size, setSize] = useState(5);
18+
const [size, setSize] = useState("xxl");
4519
return (
4620
<div className={classNames("flex", "flex-col", "gap-l", "flex-wrap")}>
4721
<div className={classNames("flex-noreset", "w-m", "flex-row", "items-start", "p-s", "gap-s", "justify-start")}>
@@ -53,18 +27,19 @@ export const AllIcons = {
5327
}}
5428
aria-label="Search icons"
5529
/>
56-
<Slider.Single
57-
aria-label="Icon size"
58-
min={1}
59-
max={11}
60-
step={1}
61-
marks={Marks}
30+
<Select.Select
31+
aria-label="Size"
6232
value={size}
63-
valueLabelFormat={(value) => SIZES[value]}
64-
onChange={(value) => {
65-
setSize(value);
33+
onChange={(e) => {
34+
setSize(e.target.value || "xxl");
6635
}}
67-
/>
36+
>
37+
{SIZES.map((currentSize) => (
38+
<Select.Option key={currentSize} value={currentSize}>
39+
{currentSize}
40+
</Select.Option>
41+
))}
42+
</Select.Select>
6843
</div>
6944
<div className={classNames("flex", "flex-row", "flex-wrap", "gap-m", "w-fit")}>
7045
{Object.entries(Icons)
@@ -77,7 +52,7 @@ export const AllIcons = {
7752
>
7853
<span className={classNames("font-script-s", "text-weak", "break-all")}>{name}</span>
7954
<div className={classNames("flex", "items-center", "justify-center", "flex-1", "text-default")}>
80-
<Icon className={classNames(`size-${SIZES[size]}`)} />
55+
<Icon className={classNames(`size-${size}`)} />
8156
</div>
8257
</div>
8358
))}

0 commit comments

Comments
 (0)