From f9cf33c498df67febf6fdba461e58b719b5017bd Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 05:40:43 +0000 Subject: [PATCH 01/13] chore: update TimelineDateRow --- .../components/Timeline/TimelineDateRow.tsx | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/site/src/components/Timeline/TimelineDateRow.tsx b/site/src/components/Timeline/TimelineDateRow.tsx index 3425b06abe05a..9fcfef2802bb0 100644 --- a/site/src/components/Timeline/TimelineDateRow.tsx +++ b/site/src/components/Timeline/TimelineDateRow.tsx @@ -1,4 +1,3 @@ -import { css, useTheme } from "@emotion/react"; import TableCell from "@mui/material/TableCell"; import TableRow from "@mui/material/TableRow"; import type { FC } from "react"; @@ -9,25 +8,10 @@ export interface TimelineDateRow { } export const TimelineDateRow: FC = ({ date }) => { - const theme = useTheme(); - return ( - + {createDisplayDate(date)} From 4dcbe001da541b000c89d740b66e0992ccb7a713 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 06:15:12 +0000 Subject: [PATCH 02/13] chore: convert TimelineEntry --- site/src/@types/react.d.ts | 7 +++ .../MultiSelectCombobox.tsx | 2 +- .../src/components/Timeline/TimelineEntry.tsx | 50 ++++--------------- 3 files changed, 19 insertions(+), 40 deletions(-) create mode 100644 site/src/@types/react.d.ts diff --git a/site/src/@types/react.d.ts b/site/src/@types/react.d.ts new file mode 100644 index 0000000000000..28df1fe213146 --- /dev/null +++ b/site/src/@types/react.d.ts @@ -0,0 +1,7 @@ +declare module "react" { + interface CSSProperties { + [key: `--${string}`]: string | number; + } +} + +export {}; diff --git a/site/src/components/MultiSelectCombobox/MultiSelectCombobox.tsx b/site/src/components/MultiSelectCombobox/MultiSelectCombobox.tsx index 8ff83f2a4583a..7b61dd379dcb6 100644 --- a/site/src/components/MultiSelectCombobox/MultiSelectCombobox.tsx +++ b/site/src/components/MultiSelectCombobox/MultiSelectCombobox.tsx @@ -496,7 +496,7 @@ export const MultiSelectCombobox = forwardRef< { clickable?: boolean; } export const TimelineEntry = forwardRef< HTMLTableRowElement, TimelineEntryProps ->(function TimelineEntry({ children, clickable = true, ...props }, ref) { +>(({ children, clickable = true, className, ...props }, ref) => { return ( {children} ); }); - -const styles = { - row: (theme) => ({ - "--side-padding": "32px", - "&:focus": { - outlineStyle: "solid", - outlineOffset: -1, - outlineWidth: 2, - outlineColor: theme.palette.primary.main, - }, - "& td": { - position: "relative", - overflow: "hidden", - }, - "& td:before": { - "--line-width": "2px", - position: "absolute", - left: "calc((var(--side-padding) + var(--avatar-default)/2) - var(--line-width) / 2)", - display: "block", - content: "''", - height: "100%", - width: "var(--line-width)", - background: theme.palette.divider, - }, - }), - - clickable: (theme) => ({ - cursor: "pointer", - - "&:hover": { - backgroundColor: theme.palette.action.hover, - }, - }), -} satisfies Record>; From f8dad466875297cfcfa771611d5f1d12efc34b91 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 06:18:29 +0000 Subject: [PATCH 03/13] refactor: convert TableToolbar --- .../components/TableToolbar/TableToolbar.tsx | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/site/src/components/TableToolbar/TableToolbar.tsx b/site/src/components/TableToolbar/TableToolbar.tsx index 4ec9f2d8ff67e..26e0ea81b563c 100644 --- a/site/src/components/TableToolbar/TableToolbar.tsx +++ b/site/src/components/TableToolbar/TableToolbar.tsx @@ -3,20 +3,8 @@ import type { FC, PropsWithChildren } from "react"; export const TableToolbar: FC = ({ children }) => { return ( -
({ - fontSize: 13, - marginBottom: "8px", - marginTop: 0, - height: "36px", // The size of a small button - color: theme.palette.text.secondary, - display: "flex", - alignItems: "center", - "& strong": { - color: theme.palette.text.primary, - }, - })} - > + // The height is meant to match the size of a small button +
{children}
); @@ -42,7 +30,7 @@ export const PaginationStatus: FC = (props) => { if (isLoading) { return ( -
+
); From 1d71eb8a6b8242f503ac0f67585526ac4d8b0ea1 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 06:24:20 +0000 Subject: [PATCH 04/13] chore: convert more --- site/src/components/SyntaxHighlighter/SyntaxHighlighter.tsx | 5 ++--- site/src/components/TableEmpty/TableEmpty.tsx | 2 +- site/src/components/TableLoader/TableLoader.tsx | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/site/src/components/SyntaxHighlighter/SyntaxHighlighter.tsx b/site/src/components/SyntaxHighlighter/SyntaxHighlighter.tsx index 160eaf1f8118d..3d575bb945983 100644 --- a/site/src/components/SyntaxHighlighter/SyntaxHighlighter.tsx +++ b/site/src/components/SyntaxHighlighter/SyntaxHighlighter.tsx @@ -44,9 +44,8 @@ export const SyntaxHighlighter: FC = ({ return (
diff --git a/site/src/components/TableEmpty/TableEmpty.tsx b/site/src/components/TableEmpty/TableEmpty.tsx index 554ba84baa3ce..d75e496ff2d2c 100644 --- a/site/src/components/TableEmpty/TableEmpty.tsx +++ b/site/src/components/TableEmpty/TableEmpty.tsx @@ -11,7 +11,7 @@ type TableEmptyProps = EmptyStateProps; export const TableEmpty: FC = (props) => { return ( - + diff --git a/site/src/components/TableLoader/TableLoader.tsx b/site/src/components/TableLoader/TableLoader.tsx index 3efaa8bb19ca0..9bafdff557792 100644 --- a/site/src/components/TableLoader/TableLoader.tsx +++ b/site/src/components/TableLoader/TableLoader.tsx @@ -6,7 +6,7 @@ import { Loader } from "../Loader/Loader"; export const TableLoader: FC = () => { return ( - + From 58423d282d6fa6bbe3d0465b8bb6fc72f85c2c31 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 06:35:02 +0000 Subject: [PATCH 05/13] chore: convert most of Stats --- site/src/components/Stats/Stats.tsx | 70 ++++++----------------------- 1 file changed, 14 insertions(+), 56 deletions(-) diff --git a/site/src/components/Stats/Stats.tsx b/site/src/components/Stats/Stats.tsx index 89717250686b7..73e35c5ff8b46 100644 --- a/site/src/components/Stats/Stats.tsx +++ b/site/src/components/Stats/Stats.tsx @@ -6,7 +6,11 @@ export const Stats: FC> = ({ ...attrs }) => { return ( -
+
{children}
); @@ -19,65 +23,19 @@ interface StatsItemProps extends HTMLAttributes { export const StatsItem: FC = ({ label, value, ...attrs }) => { return ( -
- {label}: - {value} +
+ {label}: + + {value} +
); }; const styles = { - stats: (theme) => ({ - ...(theme.typography.body2 as CSSObject), - paddingLeft: 16, - paddingRight: 16, - borderRadius: 8, - border: `1px solid ${theme.palette.divider}`, - display: "flex", - alignItems: "center", - color: theme.palette.text.secondary, - margin: "0px", - flexWrap: "wrap", - - [theme.breakpoints.down("md")]: { - display: "block", - padding: 16, - }, - }), - - statItem: (theme) => ({ - padding: 14, - paddingLeft: 16, - paddingRight: 16, - display: "flex", - alignItems: "baseline", - gap: 8, - - [theme.breakpoints.down("md")]: { - padding: 8, - }, - }), - - statsLabel: { - display: "block", - wordWrap: "break-word", + stats: (theme) => { + const value = theme.typography.body2; + console.log(value); + return value as CSSObject; }, - - statsValue: (theme) => ({ - marginTop: 2, - display: "flex", - wordWrap: "break-word", - color: theme.palette.text.primary, - alignItems: "center", - - "& a": { - color: theme.palette.text.primary, - textDecoration: "none", - fontWeight: 600, - - "&:hover": { - textDecoration: "underline", - }, - }, - }), } satisfies Record>; From 4f07d6b5d7d0e6d87b5c4b4306d86b3f05c931da Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 06:42:38 +0000 Subject: [PATCH 06/13] chore: convert StackLabel --- site/src/components/StackLabel/StackLabel.tsx | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/site/src/components/StackLabel/StackLabel.tsx b/site/src/components/StackLabel/StackLabel.tsx index 1c9b4ee0c8339..1292eab57dce0 100644 --- a/site/src/components/StackLabel/StackLabel.tsx +++ b/site/src/components/StackLabel/StackLabel.tsx @@ -10,25 +10,13 @@ import type { ComponentProps, FC } from "react"; */ export const StackLabel: FC> = (props) => { - return ( - - ); + return ; }; export const StackLabelHelperText: FC = (props) => { return ( ({ - marginTop: 0, - - "& strong": { - color: theme.palette.text.primary, - }, - })} + className="m-0 [&_strong]:text-content-primary" {...props} /> ); From 77be908d9bcd73b7cb941c50af3d4a054f650969 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 06:45:45 +0000 Subject: [PATCH 07/13] refactor: clean up Spinner --- site/src/components/Spinner/Spinner.tsx | 44 +++++++++++-------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/site/src/components/Spinner/Spinner.tsx b/site/src/components/Spinner/Spinner.tsx index 024b5ded4efed..b612f87155759 100644 --- a/site/src/components/Spinner/Spinner.tsx +++ b/site/src/components/Spinner/Spinner.tsx @@ -9,7 +9,7 @@ import { cva, type VariantProps } from "class-variance-authority"; import type { ReactNode } from "react"; import { cn } from "utils/cn"; -const leaves = 8; +const leaves = Array.from({ length: 8 }).map((_, i) => i); const spinnerVariants = cva("", { variants: { @@ -49,29 +49,25 @@ export function Spinner({ {...props} > Loading spinner - {[...Array(leaves)].map((_, i) => { - const rotation = i * (360 / leaves); - - return ( - - ); - })} + {leaves.map((leaf) => ( + + ))} ); } From b8e71387d4bc44e0efa51099983c7cb34a5b3796 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 06:50:35 +0000 Subject: [PATCH 08/13] refactor: clean up SignInLayout --- .../components/SignInLayout/SignInLayout.tsx | 41 +++---------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/site/src/components/SignInLayout/SignInLayout.tsx b/site/src/components/SignInLayout/SignInLayout.tsx index c557fd3b4c797..e63e28e1a5cdd 100644 --- a/site/src/components/SignInLayout/SignInLayout.tsx +++ b/site/src/components/SignInLayout/SignInLayout.tsx @@ -1,45 +1,16 @@ -import type { Interpolation, Theme } from "@emotion/react"; import type { FC, PropsWithChildren } from "react"; export const SignInLayout: FC = ({ children }) => { return ( -
-
-
{children}
-
+
+
+
+ {children} +
+
{"\u00a9"} {new Date().getFullYear()} Coder Technologies, Inc.
); }; - -const styles = { - container: { - flex: 1, - // Fallback to 100vh - height: ["100vh", "-webkit-fill-available"], - display: "flex", - justifyContent: "center", - alignItems: "center", - }, - - content: { - display: "flex", - flexDirection: "column", - alignItems: "center", - }, - - signIn: { - maxWidth: 385, - display: "flex", - flexDirection: "column", - alignItems: "center", - }, - - copyright: (theme) => ({ - fontSize: 12, - color: theme.palette.text.secondary, - marginTop: 24, - }), -} satisfies Record>; From a5e07079f57bf3682bd2386fd388f11950b8bbe8 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 06:57:08 +0000 Subject: [PATCH 09/13] refactor: convert SelectMenu --- site/src/components/SelectMenu/SelectMenu.tsx | 33 ++----------------- 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/site/src/components/SelectMenu/SelectMenu.tsx b/site/src/components/SelectMenu/SelectMenu.tsx index d81f8c665c482..9efd7cca378b5 100644 --- a/site/src/components/SelectMenu/SelectMenu.tsx +++ b/site/src/components/SelectMenu/SelectMenu.tsx @@ -21,8 +21,6 @@ import { useMemo, } from "react"; -const SIDE_PADDING = 16; - export const SelectMenu = Popover; export const SelectMenuTrigger = PopoverTrigger; @@ -54,22 +52,7 @@ export const SelectMenuSearch: FC = (props) => { ({ - borderBottom: `1px solid ${theme.palette.divider}`, - "& input": { - fontSize: 14, - }, - "& fieldset": { - border: 0, - borderRadius: 0, - }, - "& .MuiInputBase-root": { - padding: `12px ${SIDE_PADDING}px`, - }, - "& .MuiInputAdornment-positionStart": { - marginRight: SIDE_PADDING, - }, - })} + className="border-solid border-b-px [&_input]:font-sm [&_fieldset]:border-none [&_fieldset]:rounded-none [&.MuiInputBase-root]:py-3 [&.MuiInputBase-root]:px-4 [&.MuiInputAdornment-positionStart]:mr-4" {...props} inputProps={{ autoFocus: true, ...props.inputProps }} /> @@ -112,19 +95,9 @@ export const SelectMenuIcon: FC> = (props) => { export const SelectMenuItem: FC = (props) => { return ( - + {props.children} - {props.selected && ( - - )} + {props.selected && } ); }; From 0d406fab02c3434646dd6db448f39a3e3dfe4432 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 07:01:34 +0000 Subject: [PATCH 10/13] refactor: SearchField --- .../components/SearchField/SearchField.tsx | 33 ++++--------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/site/src/components/SearchField/SearchField.tsx b/site/src/components/SearchField/SearchField.tsx index 90a2499615c37..b67d36af08457 100644 --- a/site/src/components/SearchField/SearchField.tsx +++ b/site/src/components/SearchField/SearchField.tsx @@ -1,11 +1,9 @@ -import { useTheme } from "@emotion/react"; import IconButton from "@mui/material/IconButton"; import InputAdornment from "@mui/material/InputAdornment"; import TextField, { type TextFieldProps } from "@mui/material/TextField"; import Tooltip from "@mui/material/Tooltip"; -import visuallyHidden from "@mui/utils/visuallyHidden"; import { SearchIcon, XIcon } from "lucide-react"; -import { type FC, useEffect, useRef } from "react"; +import type { FC } from "react"; export type SearchFieldProps = Omit & { onChange: (query: string) => void; @@ -19,46 +17,27 @@ export const SearchField: FC = ({ InputProps, ...textFieldProps }) => { - const theme = useTheme(); - const inputRef = useRef(null); - - useEffect(() => { - if (autoFocus) { - inputRef.current?.focus(); - } - }); - return ( onChange(e.target.value)} - inputRef={inputRef} InputProps={{ startAdornment: ( - + ), endAdornment: value !== "" && ( - { - onChange(""); - }} - > + onChange("")}> - Clear search + Clear search From c56216319745f3f176863400134b2116ab983fa2 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 07:04:12 +0000 Subject: [PATCH 11/13] chore: delete Search --- site/src/components/Search/Search.stories.tsx | 26 ---- site/src/components/Search/Search.tsx | 117 ------------------ 2 files changed, 143 deletions(-) delete mode 100644 site/src/components/Search/Search.stories.tsx delete mode 100644 site/src/components/Search/Search.tsx diff --git a/site/src/components/Search/Search.stories.tsx b/site/src/components/Search/Search.stories.tsx deleted file mode 100644 index b923a2895273e..0000000000000 --- a/site/src/components/Search/Search.stories.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react-vite"; -import { Search, SearchInput } from "./Search"; - -const meta: Meta = { - title: "components/Search", - component: SearchInput, - decorators: [ - (Story) => ( - - - - ), - ], -}; - -export default meta; -type Story = StoryObj; - -export const Example: Story = {}; - -export const WithPlaceholder: Story = { - args: { - label: "uwu", - placeholder: "uwu", - }, -}; diff --git a/site/src/components/Search/Search.tsx b/site/src/components/Search/Search.tsx deleted file mode 100644 index 7fecd57df2bf9..0000000000000 --- a/site/src/components/Search/Search.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import type { Interpolation, Theme } from "@emotion/react"; -// biome-ignore lint/style/noRestrictedImports: use it to have the component prop -import Box, { type BoxProps } from "@mui/material/Box"; -import visuallyHidden from "@mui/utils/visuallyHidden"; -import { SearchIcon } from "lucide-react"; -import type { FC, HTMLAttributes, InputHTMLAttributes, Ref } from "react"; - -interface SearchProps extends Omit { - $$ref?: Ref; -} - -/** - * A container component meant for `SearchInput` - * - * ``` - * - * - * - * ``` - */ -export const Search: FC = ({ children, $$ref, ...boxProps }) => { - return ( - - - {children} - - ); -}; - -const SearchStyles = { - container: (theme) => ({ - display: "flex", - alignItems: "center", - paddingLeft: 16, - height: 40, - borderBottom: `1px solid ${theme.palette.divider}`, - }), - - icon: (theme) => ({ - fontSize: 14, - color: theme.palette.text.secondary, - }), -} satisfies Record>; - -type SearchInputProps = InputHTMLAttributes & { - label?: string; - $$ref?: Ref; -}; - -export const SearchInput: FC = ({ - label, - $$ref, - ...inputProps -}) => { - return ( - <> - - - - ); -}; - -const SearchInputStyles = { - input: (theme) => ({ - color: "inherit", - height: "100%", - border: 0, - background: "none", - flex: 1, - marginLeft: 16, - outline: 0, - "&::placeholder": { - color: theme.palette.text.secondary, - }, - }), -} satisfies Record>; - -export const SearchEmpty: FC> = ({ - children = "Not found", - ...props -}) => { - return ( -
- {children} -
- ); -}; - -const SearchEmptyStyles = { - empty: (theme) => ({ - fontSize: 13, - color: theme.palette.text.secondary, - textAlign: "center", - paddingTop: 8, - paddingBottom: 8, - }), -} satisfies Record>; - -/** - * Reusable styles for consumers of the base components - */ -export const searchStyles = { - content: { - width: 320, - padding: 0, - borderRadius: 4, - }, -} satisfies Record>; From 0386e5913271b3bdf99b9b6eb0a5bbb27bec9a6b Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 07:07:35 +0000 Subject: [PATCH 12/13] fix: add files back --- site/src/components/Search/Search.stories.tsx | 26 ++++ site/src/components/Search/Search.tsx | 118 ++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 site/src/components/Search/Search.stories.tsx create mode 100644 site/src/components/Search/Search.tsx diff --git a/site/src/components/Search/Search.stories.tsx b/site/src/components/Search/Search.stories.tsx new file mode 100644 index 0000000000000..b923a2895273e --- /dev/null +++ b/site/src/components/Search/Search.stories.tsx @@ -0,0 +1,26 @@ +import type { Meta, StoryObj } from "@storybook/react-vite"; +import { Search, SearchInput } from "./Search"; + +const meta: Meta = { + title: "components/Search", + component: SearchInput, + decorators: [ + (Story) => ( + + + + ), + ], +}; + +export default meta; +type Story = StoryObj; + +export const Example: Story = {}; + +export const WithPlaceholder: Story = { + args: { + label: "uwu", + placeholder: "uwu", + }, +}; diff --git a/site/src/components/Search/Search.tsx b/site/src/components/Search/Search.tsx new file mode 100644 index 0000000000000..f81c0629279f6 --- /dev/null +++ b/site/src/components/Search/Search.tsx @@ -0,0 +1,118 @@ +// biome-ignore lint/style/noRestrictedImports: use it to have the component prop +import type { Interpolation } from "@emotion/react"; +import type { Theme } from "@mui/material"; +import Box, { type BoxProps } from "@mui/material/Box"; +import visuallyHidden from "@mui/utils/visuallyHidden"; +import { SearchIcon } from "lucide-react"; +import type { FC, HTMLAttributes, InputHTMLAttributes, Ref } from "react"; + +interface SearchProps extends Omit { + $$ref?: Ref; +} + +/** + * A container component meant for `SearchInput` + * + * ``` + * + * + * + * ``` + */ +export const Search: FC = ({ children, $$ref, ...boxProps }) => { + return ( + + + {children} + + ); +}; + +const SearchStyles = { + container: (theme) => ({ + display: "flex", + alignItems: "center", + paddingLeft: 16, + height: 40, + borderBottom: `1px solid ${theme.palette.divider}`, + }), + + icon: (theme) => ({ + fontSize: 14, + color: theme.palette.text.secondary, + }), +} satisfies Record>; + +type SearchInputProps = InputHTMLAttributes & { + label?: string; + $$ref?: Ref; +}; + +export const SearchInput: FC = ({ + label, + $$ref, + ...inputProps +}) => { + return ( + <> + + + + ); +}; + +const SearchInputStyles = { + input: (theme) => ({ + color: "inherit", + height: "100%", + border: 0, + background: "none", + flex: 1, + marginLeft: 16, + outline: 0, + "&::placeholder": { + color: theme.palette.text.secondary, + }, + }), +} satisfies Record>; + +export const SearchEmpty: FC> = ({ + children = "Not found", + ...props +}) => { + return ( +
+ {children} +
+ ); +}; + +const SearchEmptyStyles = { + empty: (theme) => ({ + fontSize: 13, + color: theme.palette.text.secondary, + textAlign: "center", + paddingTop: 8, + paddingBottom: 8, + }), +} satisfies Record>; + +/** + * Reusable styles for consumers of the base components + */ +export const searchStyles = { + content: { + width: 320, + padding: 0, + borderRadius: 4, + }, +} satisfies Record>; From d3e41aff8f313bd4f8661d0a02f3bc1c5af51158 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 15 Aug 2025 07:18:18 +0000 Subject: [PATCH 13/13] refactor: Search --- site/src/components/Search/Search.tsx | 99 +++++++++++++-------------- 1 file changed, 46 insertions(+), 53 deletions(-) diff --git a/site/src/components/Search/Search.tsx b/site/src/components/Search/Search.tsx index f81c0629279f6..07a88ae7cec70 100644 --- a/site/src/components/Search/Search.tsx +++ b/site/src/components/Search/Search.tsx @@ -1,13 +1,18 @@ // biome-ignore lint/style/noRestrictedImports: use it to have the component prop import type { Interpolation } from "@emotion/react"; import type { Theme } from "@mui/material"; -import Box, { type BoxProps } from "@mui/material/Box"; -import visuallyHidden from "@mui/utils/visuallyHidden"; import { SearchIcon } from "lucide-react"; -import type { FC, HTMLAttributes, InputHTMLAttributes, Ref } from "react"; +import { + type FC, + type HTMLAttributes, + type InputHTMLAttributes, + type Ref, + useId, +} from "react"; +import { cn } from "utils/cn"; -interface SearchProps extends Omit { - $$ref?: Ref; +interface SearchProps extends Omit, "ref"> { + $$ref?: Ref; } /** @@ -19,93 +24,81 @@ interface SearchProps extends Omit { * * ``` */ -export const Search: FC = ({ children, $$ref, ...boxProps }) => { +export const Search: FC = ({ + children, + $$ref, + className, + ...boxProps +}) => { return ( - - +
+ {children} - +
); }; -const SearchStyles = { - container: (theme) => ({ - display: "flex", - alignItems: "center", - paddingLeft: 16, - height: 40, - borderBottom: `1px solid ${theme.palette.divider}`, - }), - - icon: (theme) => ({ - fontSize: 14, - color: theme.palette.text.secondary, - }), -} satisfies Record>; - type SearchInputProps = InputHTMLAttributes & { label?: string; $$ref?: Ref; }; export const SearchInput: FC = ({ - label, $$ref, + id, + label, + className, ...inputProps }) => { + const hookId = useId(); + const inputId = id || `${hookId}-input`; + return ( <> -