Optimized a few components

This commit is contained in:
Gregory Schier
2023-03-18 18:49:01 -07:00
parent afcf630443
commit c0d9740a7d
17 changed files with 200 additions and 156 deletions

View File

@@ -28,6 +28,7 @@ import {
UpdateIcon,
} from '@radix-ui/react-icons';
import classnames from 'classnames';
import { memo } from 'react';
const icons = {
archive: ArchiveIcon,
@@ -67,7 +68,7 @@ export interface IconProps {
spin?: boolean;
}
export function Icon({ icon, spin, size = 'md', className }: IconProps) {
export const Icon = memo(function Icon({ icon, spin, size = 'md', className }: IconProps) {
const Component = icons[icon] ?? icons.question;
return (
<Component
@@ -81,4 +82,4 @@ export function Icon({ icon, spin, size = 'md', className }: IconProps) {
)}
/>
);
}
});