Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add icon assets and Icon, AccessibleIconButton components #21

Merged
merged 7 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.2.2",
"vite": "^5.0.8"
"vite": "^5.0.8",
"vite-plugin-svgr": "^4.2.0"
}
}
213 changes: 213 additions & 0 deletions src/web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/web/src/@types/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ export type FontKeyType =
| 'body-3';

export type ColorType =
| 'white'
| 'grey-100'
| 'grey-200'
| 'grey-300'
| 'grey-400'
| 'grey-500'
| 'grey-600'
| 'black'
| 'blueGrey-100'
| 'blueGrey-200'
| 'blueGrey-300'
Expand Down
4 changes: 4 additions & 0 deletions src/web/src/@types/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: React.FC<React.SVGProps<SVGElement>>;
export default content;
}
36 changes: 36 additions & 0 deletions src/web/src/components/common/AccessibleIconButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { ButtonHTMLAttributes } from 'react';

import type { IconKeyType } from './Icon';
import type { ColorType } from '@/@types';
import Icon from './Icon';
import VisuallyHidden from './VisuallyHidden';

interface AccessibleIconButtonProps
extends ButtonHTMLAttributes<HTMLButtonElement> {
iconType: IconKeyType;
/**
* 스크린 리더기에서만 읽을 수 있는 라벨입니다.
*/
label: string;
fill?: ColorType;
stroke?: ColorType;
}

function AccessibleIconButton({
iconType,
label,
fill,
stroke,
...props
}: AccessibleIconButtonProps) {
return (
<button type="button" {...props}>
<VisuallyHidden>
<div role="text">{label}</div>
</VisuallyHidden>
<Icon type={iconType} fill={fill} stroke={stroke} />
</button>
);
}

export default AccessibleIconButton;
Loading