refactor: memoize icons on export

This commit is contained in:
rusconn
2023-06-24 09:26:37 +09:00
parent 257080b00d
commit 240fba0e74
14 changed files with 74 additions and 101 deletions

View File

@@ -1,5 +1,3 @@
import { useMemo } from "react";
import { icons } from "@/components/icons";
import { BaseButton, BaseButtonProps } from "./base";
@@ -7,7 +5,5 @@ import { BaseButton, BaseButtonProps } from "./base";
export type ClearButtonProps = Omit<BaseButtonProps, "icon" | "labelText">;
export function ClearButton({ iconOnly, ...props }: ClearButtonProps) {
const icon = useMemo(() => <icons.X size={16} />, []);
return <BaseButton {...props} {...{ icon, iconOnly }} labelText="Clear" />;
return <BaseButton {...props} icon={<icons.X size={16} />} {...{ iconOnly }} labelText="Clear" />;
}