Skip to content

Commit

Permalink
feat: icon 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
miro-ring committed Jan 16, 2024
1 parent cbba002 commit 57d5fd0
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/assets/icons/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/logout.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/profileDialog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/setting.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@ import { iconFactory, type Icons } from '../../constants/icon';

interface IconProps {
icon: Icons;
className?: string;
color?: string;
width?: number;
height?: number;
}

const Icon = ({ icon, color, width = 24, height = 24 }: IconProps) => {
const Icon = ({
icon,
className,
color,
width = 24,
height = 24,
}: IconProps) => {
const SvgIcon = iconFactory[icon];

return <SvgIcon color={color} width={width} height={height} />;
return (
<SvgIcon
className={className}
color={color}
width={width}
height={height}
/>
);
};

export default Icon;
10 changes: 9 additions & 1 deletion src/constants/icon.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import Add from '@assets/icons/add.svg';
import Close from '@assets/icons/close.svg';
import Logout from '@assets/icons/logout.svg';
import Profle from '@assets/icons/profile.svg';
import ProfileDialog from '@assets/icons/profileDialog.svg';
import Setting from '@assets/icons/setting.svg';
import Submit from '@assets/icons/submit.svg';

export const iconFactory = {
add: Add,
close: Close,
logout: Logout,
profile: Profle,
profileDialog: ProfileDialog,
setting: Setting,
submit: Submit,
close: Close,
};

export type Icons = keyof typeof iconFactory;

0 comments on commit 57d5fd0

Please sign in to comment.