Skip to content

Commit f38bd30

Browse files
committed
fix: props
1 parent 9548e84 commit f38bd30

File tree

3 files changed

+33
-34
lines changed

3 files changed

+33
-34
lines changed

packages/component-library/src/SearchButton/index.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
display: none;
1515
}
1616
}
17-
}
17+
}

packages/component-library/src/SearchButton/index.stories.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { Meta, StoryObj } from "@storybook/react";
44
import { SearchButton as SearchButtonComponent } from "./index.jsx";
55
import { SIZES } from "../Button/index.jsx";
66

7-
87
const iconControl = {
98
control: "select",
109
options: Object.keys(icons),
@@ -19,7 +18,7 @@ const iconControl = {
1918
const meta = {
2019
component: SearchButtonComponent,
2120
argTypes: {
22-
size: {
21+
size: {
2322
control: "inline-radio",
2423
options: SIZES,
2524
table: {
@@ -32,7 +31,6 @@ const meta = {
3231
category: "Contents",
3332
},
3433
},
35-
3634
},
3735
} satisfies Meta<typeof SearchButtonComponent>;
3836
export default meta;
Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
"use client";
22

3-
import { MagnifyingGlass } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass';
4-
import type { ComponentProps, ReactNode } from "react";
3+
import { MagnifyingGlass } from "@phosphor-icons/react/dist/ssr/MagnifyingGlass";
4+
import clsx from "clsx";
5+
import type { ReactNode } from "react";
6+
import { Button as BaseButton } from "react-aria-components";
57

8+
import type { Props as ButtonProps } from "../Button";
69
import { Button } from "../Button";
710
import styles from "./index.module.scss";
811

9-
1012
type OwnProps = {
1113
largeScreenContent?: ReactNode;
1214
smallScreenContent?: ReactNode;
1315
};
1416

15-
type Props = Pick<
16-
ComponentProps<typeof Button>,
17-
'beforeIcon' | 'size' | 'onClick'
17+
type Props = Pick<
18+
ButtonProps<typeof BaseButton>,
19+
"beforeIcon" | "size" | "onClick" | "className" | "isPending"
1820
> &
1921
OwnProps;
20-
22+
2123
export const SearchButton = ({
2224
beforeIcon,
2325
largeScreenContent,
@@ -26,28 +28,27 @@ export const SearchButton = ({
2628
}: Props) => {
2729
return (
2830
<div className={styles.searchButton}>
29-
<Button
30-
className={styles.largeScreenSearchButton ?? ""}
31-
variant="outline"
32-
beforeIcon={beforeIcon ?? <MagnifyingGlass />}
33-
size="sm"
34-
rounded
35-
36-
{...props}
37-
>
38-
{largeScreenContent}
39-
</Button>
40-
<Button
41-
className={styles.smallScreenSearchButton ?? ""}
42-
hideText
43-
variant="ghost"
44-
beforeIcon={beforeIcon ?? <MagnifyingGlass />}
45-
size="sm"
46-
rounded
47-
{...props}
48-
>
49-
{smallScreenContent}
50-
</Button>
51-
</div>
31+
<Button
32+
className={clsx(styles.largeScreenSearchButton, props.className)}
33+
variant="outline"
34+
beforeIcon={beforeIcon ?? <MagnifyingGlass />}
35+
size="sm"
36+
rounded
37+
{...props}
38+
>
39+
{largeScreenContent}
40+
</Button>
41+
<Button
42+
className={clsx(styles.smallScreenSearchButton, props.className)}
43+
hideText
44+
variant="ghost"
45+
beforeIcon={beforeIcon ?? <MagnifyingGlass />}
46+
size="sm"
47+
rounded
48+
{...props}
49+
>
50+
{smallScreenContent}
51+
</Button>
52+
</div>
5253
);
5354
};

0 commit comments

Comments
 (0)