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/스토리북 아이콘 갤러리 작업 #33

Merged
merged 4 commits into from
May 6, 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
2 changes: 1 addition & 1 deletion src/components/common/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Avatar = ({ profileUrl, size = AVATAR_SIZE.LG }: IAvatar) => {
<div
className={cn('bg-surface-empty rounded-[50%] flex justify-center items-center', boxSize)}
>
<Icon name='user_s' className={cn('stroke-icon-minimal', iconSize)} />
<Icon name='user_s' className={cn('text-icon-minimal', iconSize)} />
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ type Story = StoryObj<typeof meta>;
export const Primary: Story = {
args: {
name: 'xClose_s',
className: 'w-[100px] h-[100px] stroke-critical',
className: 'w-[100px] h-[100px] text-critical',
},
};
2 changes: 1 addition & 1 deletion src/components/common/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IconProps extends SVGProps<SVGSVGElement> {
className?: string;
}

const Icon = ({ name, className, ...props }: IconProps) => {
const Icon = ({ name, className = 'h-16 w-16 text-icon-sub', ...props }: IconProps) => {
const IconComponent = iconTypes[name];

return <IconComponent className={className} {...props} />;
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Icon/lib/check_indeterminate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/check_off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/check_on.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/chevron_down.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: 2 additions & 2 deletions src/components/common/Icon/lib/home_04.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/search_sm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/warning_triangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/common/Icon/lib/x_close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/components/common/Tag/Tag.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const TagWithRightIcon: Story = {
children: (
<>
<Tag.Label>전체</Tag.Label>
<Icon name='xClose_s' className='w-16 h-16 stroke-icon-sub' />
<Icon name='xClose_s' className='w-16 h-16 text-icon-sub' />
</>
),
},
Expand All @@ -51,7 +51,7 @@ export const TagWithLeftIcon: Story = {
isButton: true,
children: (
<>
<Icon name='xClose_s' className='w-16 h-16 stroke-icon-sub' />
<Icon name='xClose_s' className='w-16 h-16 text-icon-sub' />
<Tag.Label>전체</Tag.Label>
</>
),
Expand All @@ -66,7 +66,7 @@ export const TagWithLongLabel: Story = {
children: (
<>
<Tag.Label>긴태그긴태그긴태그긴태그긴태그</Tag.Label>
<Icon name='xClose_s' className='w-16 h-16 stroke-icon-sub' />
<Icon name='xClose_s' className='w-16 h-16 text-icon-sub' />
</>
),
},
Expand Down
23 changes: 19 additions & 4 deletions src/stories/Colors.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { Meta, ColorPalette, ColorItem } from '@storybook/blocks';
import { colors } from 'styles/theme';

<Meta title='Colors' />
<Meta title='Common/Color/Colors' />

<ColorPalette>
{Object.keys(colors).map((category) => {
const categoryValue = colors[category];
if (typeof categoryValue === 'object' && !Array.isArray(categoryValue) && categoryValue !== null) {
if (
typeof categoryValue === 'object' &&
!Array.isArray(categoryValue) &&
categoryValue !== null
) {
// 색상이 객체로 further nested된 경우
return Object.keys(categoryValue).map((subCategory) => {
const subCategoryValue = categoryValue[subCategory];
if (typeof subCategoryValue === 'object' && !Array.isArray(subCategoryValue) && subCategoryValue !== null) {
if (
typeof subCategoryValue === 'object' &&
!Array.isArray(subCategoryValue) &&
subCategoryValue !== null
) {
// 더욱 세부적인 nested colors 처리
return (
<ColorItem
Expand All @@ -34,7 +42,14 @@ import { colors } from 'styles/theme';
});
} else {
// Single depth color 처리
return <ColorItem key={category} title={`theme.color.${category}`} subtitle={`${category}`} colors={{ [category]: categoryValue }} />;
return (
<ColorItem
key={category}
title={`theme.color.${category}`}
subtitle={`${category}`}
colors={{ [category]: categoryValue }}
/>
);
}
})}
</ColorPalette>
17 changes: 17 additions & 0 deletions src/stories/IconGallery.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Meta, Title, IconGallery, IconItem } from '@storybook/blocks';
import * as iconTypes from '../components/common/Icon/lib/index';
import Icon from '../components/common/Icon';

<Meta title='Common/Icon/Icons' />

<h1>Icons</h1>
<p>기본 사이즈 16 x 16 / 컬러 text-icon-sub</p>

<br />
<IconGallery>
{Object.keys(iconTypes).map((key) => (
<IconItem name={key}>
<Icon name={key} />
</IconItem>
))}
</IconGallery>
Loading