From 232df9fb065bb297032165c679c19b73929e5725 Mon Sep 17 00:00:00 2001 From: sohee Date: Wed, 17 Apr 2024 19:11:40 +0900 Subject: [PATCH 1/2] feat: Icons storybook --- apps/docs/.storybook/main.ts | 7 + apps/docs/package.json | 6 +- apps/docs/src/index.css | 28 ++++ apps/docs/src/stories/Icons.stories.tsx | 193 ++++++++++++++++++++++++ yarn.lock | 5 + 5 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 apps/docs/src/stories/Icons.stories.tsx diff --git a/apps/docs/.storybook/main.ts b/apps/docs/.storybook/main.ts index 2449fd7..11217df 100644 --- a/apps/docs/.storybook/main.ts +++ b/apps/docs/.storybook/main.ts @@ -24,5 +24,12 @@ const config: StorybookConfig = { docs: { autodocs: "tag", }, + async viteFinal(config) { + const { mergeConfig } = await import('vite'); + + return mergeConfig(config, { + optimizeDeps: ['@sopt-makers/icons'] + }); + }, }; export default config; diff --git a/apps/docs/package.json b/apps/docs/package.json index b915d16..308902f 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -13,9 +13,9 @@ "chromatic": "npx chromatic --project-token=chpt_98c750b6bad066a" }, "dependencies": { - "@sopt-makers/colors": "^3.0.0", - "@sopt-makers/fonts": "^2.0.0", - "@sopt-makers/icons": "^1.0.0", + "@sopt-makers/colors": "^3.0.1", + "@sopt-makers/fonts": "^2.0.1", + "@sopt-makers/icons": "^1.0.4", "@sopt-makers/ui": "^1.1.5" }, "devDependencies": { diff --git a/apps/docs/src/index.css b/apps/docs/src/index.css index 4644762..bbaab4a 100644 --- a/apps/docs/src/index.css +++ b/apps/docs/src/index.css @@ -44,4 +44,32 @@ body { format('woff2'); font-weight: 700; font-style: normal; +} + +.icons-wrap { + display: flex; + gap: 40px; + padding: 20px; + width: max-content; +} + +.icons-group { + display: flex; + flex-direction: column; + gap: 16px; + color: white; + font-family: 'SUIT', sans-serif; + + h4 { + font-size: 28px; + font-weight: 700; + margin-bottom: 10px; + } + div { + display: flex; + gap: 16px; + } + p { + font-size: 20px; + } } \ No newline at end of file diff --git a/apps/docs/src/stories/Icons.stories.tsx b/apps/docs/src/stories/Icons.stories.tsx new file mode 100644 index 0000000..667e633 --- /dev/null +++ b/apps/docs/src/stories/Icons.stories.tsx @@ -0,0 +1,193 @@ +import * as Icons from '@sopt-makers/icons'; + +export default { + title: 'icons/Icons', + component: Icons, +} + +export const Default = { + argTypes: { + color: { control: 'color' }, + }, + render: (props: { color: string }) => { + const style = { width: 24, height: 24, color: props.color }; + + return
+
+

Communication

+

archive

+

bookmark

+

edit

+

eye-off

+

eye

+

mail

+

mento

+

message-alert

+

message-chat

+

message-check

+

message-dots

+

message-plus

+

message-question

+

message-square

+

message-text

+

message-x

+

pin

+

send

+
+ +
+

Editor

+

align-center

+

align-justify

+

align-left

+

align-right

+

attachment

+

bold

+

code

+

delete

+

dotpoints

+

italic

+

left-indent

+

letter-spacing

+

line-height

+

paragraph-spacing

+

paragraph-wrap

+

right-indent

+

type-strikethrough

+

type

+

underline

+

write

+

zoom-in

+

zoom-out

+
+ +
+

Feedback

+

alert-circle

+

alert-triangle

+

bell-active

+

bell-off

+

bell

+

help-circle

+

info-circle

+

thumbs-down

+

thumbs-up

+
+ +
+

Files

+

file-check

+

file-download

+

file-minus

+

file-plus

+

file-search

+

file-text

+

file-x

+

file

+

folder-check

+

folder-download

+

folder

+
+ +
+

General

+

icon-copy

+

dots-vertical

+

download-cloud

+

home

+

link

+

lock

+

log-in

+

log-out

+

menu

+

search

+

settings

+

share

+

sliders

+

trash

+

unlocked

+

upload-cloud

+
+ +
+

Interaction

+

arrow-down-left

+

arrow-down-right

+

arrow-down

+

arrow-left

+

arrow-right

+

arrow-up-left

+

arrow-up-right

+

arrow-up

+

check-circle

+

check-square

+

check

+

chevron-down

+

chevron-left

+

chevron-right

+

chevron-up

+

flip-backward

+

flip-forward

+

heart

+

plus-circle

+

plus-square

+

plus

+

refresh

+

switch-horizontal

+

switch-vertical

+

x-circle

+

x-close

+
+ +
+

Media

+

camera-off

+

camera-plus

+

camera

+

image-check

+

image-down

+

image-left

+

image-plus

+

image-right

+

image-up

+

image

+

power

+

repeat

+

video-off

+

video

+
+ +
+

Time

+

alarm-clock-check

+

alarm-clock-minus

+

alarm-clock-off

+

alarm-clock-plus

+

alarm-clock

+

calendar-check

+

calendar-date

+

calendar-plus

+

calendar

+

clock-check

+

clock-plus

+

clock-snooze

+

clock

+
+ +
+

Users

+

user-check

+

user-edit

+

user-minus

+

user-plus

+

user-x

+

user

+

users-check

+

users-minus

+

users-plus

+

users-x

+

users

+
+
+ } +}; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index a03f1d9..ad48ebb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2401,6 +2401,11 @@ resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== +"@sopt-makers/icons@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@sopt-makers/icons/-/icons-1.0.4.tgz#ad4ea15f31d3202988c2db315c94ae42505165af" + integrity sha512-MnEiiSA8lQGBIVL0R8G/Ojpq7IjOLEw05x2s0yscHwSCFIUuaCkbZ651i3woZjJ9wj677iGlzDW3BHekzX78uw== + "@storybook/addon-actions@7.6.17": version "7.6.17" resolved "https://registry.npmjs.org/@storybook/addon-actions/-/addon-actions-7.6.17.tgz" From 7e592e71aefbc0ee913839aa5678c0dc0762a498 Mon Sep 17 00:00:00 2001 From: sohee Date: Wed, 17 Apr 2024 19:55:15 +0900 Subject: [PATCH 2/2] feat: Colors storybook --- apps/docs/src/index.css | 29 ++++++ apps/docs/src/stories/Colors.stories.tsx | 111 +++++++++++++++++++++++ apps/docs/src/stories/Icons.stories.tsx | 3 +- 3 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 apps/docs/src/stories/Colors.stories.tsx diff --git a/apps/docs/src/index.css b/apps/docs/src/index.css index bbaab4a..c0e710b 100644 --- a/apps/docs/src/index.css +++ b/apps/docs/src/index.css @@ -72,4 +72,33 @@ body { p { font-size: 20px; } +} + +.colors-wrap { + display: flex; + flex-direction: column; + gap: 20px; + padding: 20px; + color: white; + + h4 { + font-size: 28px; + font-weight: 700; + margin: 40px 0 20px 0; + } +} + +.colors-group { + p { + font-size: 20px; + margin-bottom: 10px; + } + .color-chips { + display: flex; + + a { + width: 80px; + height: 80px; + } + } } \ No newline at end of file diff --git a/apps/docs/src/stories/Colors.stories.tsx b/apps/docs/src/stories/Colors.stories.tsx new file mode 100644 index 0000000..0990324 --- /dev/null +++ b/apps/docs/src/stories/Colors.stories.tsx @@ -0,0 +1,111 @@ +import { colors } from '@sopt-makers/colors'; + +export default { + title: 'colors/Colors' +} + +export const Default = { + render: () => { + const grayScales = [950, 900, 800, 700, 600, 500, 400, 300, 200, 100, 50, 30, 10]; + const scales = [900, 800, 700, 600, 500, 400, 300, 200, 100, 50]; + const alphaScales = [900, 800, 700, 600, 500, 400, 300, 200, 100]; + + const renderColorChips = (scalesArr: number[], name: string) => + scalesArr.map(item => { + const key = `${name}${item}` as keyof typeof colors; + return + }); + + return
+

* 마우스 오버시 이름과 코드가 뜹니다 *

+ +

Main Color

+
+

black

+
+
+
+

white

+
+
+ +

Gray Scale

+
+

grayscale

+
{renderColorChips(grayScales, 'gray')}
+
+ +

Scale Color

+
+

blue

+
{renderColorChips(scales, 'blue')}
+
+
+

red

+
{renderColorChips(scales, 'red')}
+
+
+

green

+
{renderColorChips(scales, 'green')}
+
+
+

yellow

+
{renderColorChips(scales, 'yellow')}
+
+ +

Sub Color

+
+

orange

+
{renderColorChips(scales, 'orange')}
+
+ +

Alpha Color

+
+

red

+
{renderColorChips(alphaScales, 'red')}
+
+
+

orange

+
{renderColorChips(alphaScales, 'orange')}
+
+
+

blue

+
{renderColorChips(alphaScales, 'blue')}
+
+
+

gray

+
{renderColorChips(alphaScales, 'gray')}
+
+ +

Semantic Color

+
+

background

+
+
+
+

background-dimmed

+
+
+
+

secondary

+
+
+
+

success

+
+
+
+

error

+
+
+
+

information

+
+
+
+

attention

+
+
+
+ } +} \ No newline at end of file diff --git a/apps/docs/src/stories/Icons.stories.tsx b/apps/docs/src/stories/Icons.stories.tsx index 667e633..89b5889 100644 --- a/apps/docs/src/stories/Icons.stories.tsx +++ b/apps/docs/src/stories/Icons.stories.tsx @@ -1,8 +1,7 @@ import * as Icons from '@sopt-makers/icons'; export default { - title: 'icons/Icons', - component: Icons, + title: 'icons/Icons' } export const Default = {