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]: Tag 컴포넌트 구현 #132

Merged
merged 4 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
24 changes: 24 additions & 0 deletions apps/wow-docs/styled-system/tokens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,30 @@ const tokens = {
value: "#000000",
variable: "var(--colors-github)",
},
"colors.secondaryYellow": {
value: "#F9AB00",
variable: "var(--colors-secondary-yellow)",
},
"colors.secondaryGreen": {
value: "#34A853",
variable: "var(--colors-secondary-green)",
},
"colors.secondaryRed": {
value: "#EA4335",
variable: "var(--colors-secondary-red)",
},
"colors.errorBackground": {
value: "#FBD9D7",
variable: "var(--colors-error-background)",
},
"colors.blueDisabled": {
value: "#D7E9FD",
variable: "var(--colors-blue-disabled)",
},
"colors.textBlueDisabled": {
value: "#AFD2FC",
variable: "var(--colors-text-blue-disabled)",
},
"spacing.-xxs": {
value: "calc(var(--spacing-xxs) * -1)",
variable: "var(--spacing-xxs)",
Expand Down
20 changes: 19 additions & 1 deletion apps/wow-docs/styled-system/tokens/tokens.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ export type Token =
| "colors.blueShadow"
| "colors.discord"
| "colors.github"
| "colors.secondaryYellow"
| "colors.secondaryGreen"
| "colors.secondaryRed"
| "colors.errorBackground"
| "colors.blueDisabled"
| "colors.textBlueDisabled"
| "spacing.-xxs"
| "spacing.-xs"
| "spacing.-sm"
Expand Down Expand Up @@ -170,7 +176,13 @@ export type ColorPalette =
| "shadowMedium"
| "blueShadow"
| "discord"
| "github";
| "github"
| "secondaryYellow"
| "secondaryGreen"
| "secondaryRed"
| "errorBackground"
| "blueDisabled"
| "textBlueDisabled";

export type ColorToken =
| "red.50"
Expand Down Expand Up @@ -262,6 +274,12 @@ export type ColorToken =
| "blueShadow"
| "discord"
| "github"
| "secondaryYellow"
| "secondaryGreen"
| "secondaryRed"
| "errorBackground"
| "blueDisabled"
| "textBlueDisabled"
| "colorPalette.50"
| "colorPalette.100"
| "colorPalette.150"
Expand Down
8 changes: 7 additions & 1 deletion apps/wow-docs/styled-system/types/prop-type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,13 @@ export interface UtilityValues {
| "shadowMedium"
| "blueShadow"
| "discord"
| "github";
| "github"
| "secondaryYellow"
| "secondaryGreen"
| "secondaryRed"
| "errorBackground"
| "blueDisabled"
| "textBlueDisabled";
textStyle:
| "display1"
| "display2"
Expand Down
6 changes: 6 additions & 0 deletions packages/wow-theme/src/config/colorTokenList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ export const colorTokenList = [
"backgroundNormal",
"backgroundAlternative",
"backgroundDimmer",
"errorBackground",
"sub",
"outline",
"textBlack",
"textWhite",
"darkDisabled",
"lightDisabled",
"blueDisabled",
"textBlueDisabled",
"blueHover",
"monoHover",
"elevatedHover",
Expand All @@ -97,6 +100,9 @@ export const colorTokenList = [
"blueShadow",
"discord",
"github",
"secondaryYellow",
"secondaryGreen",
"secondaryRed",
"blueGradientDark",
"blueGradientLight",
"redGradientDark",
Expand Down
6 changes: 6 additions & 0 deletions packages/wow-theme/src/tokens/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ export const semanticTokens = defineSemanticTokens({
blueShadow: { value: color.blueShadow },
discord: { value: color.discord },
github: { value: color.github },
secondaryYellow: { value: color.secondaryYellow },
secondaryGreen: { value: color.secondaryGreen },
secondaryRed: { value: color.secondaryRed },
errorBackground: { value: color.errorBackground },
blueDisabled: { value: color.blueDisabled },
textBlueDisabled: { value: color.textBlueDisabled },
},
});

Expand Down
8 changes: 7 additions & 1 deletion packages/wow-tokens/src/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const error = red600;
export const backgroundNormal = white;
export const backgroundAlternative = mono50;
export const backgroundDimmer = blackOpacity80;
export const errorBackground = red100;

export const sub = mono700;
export const outline = mono400;
Expand All @@ -104,10 +105,11 @@ export const textWhite = white;

export const darkDisabled = mono400;
export const lightDisabled = mono200;
export const blueDisabled = blue100;
export const textBlueDisabled = blue200;

export const blueHover = blue600;
export const monoHover = mono950;

export const elevatedHover = "rgba(16, 43, 74, 0.2)";

export const bluePressed = blue400;
Expand All @@ -121,6 +123,10 @@ export const blueShadow = "rgba(16, 43, 74, 0.2)";
export const discord = "#5566FB";
export const github = black;

export const secondaryYellow = yellow500;
export const secondaryGreen = green500;
export const secondaryRed = red500;

export const blueGradientDark = {
gradientFrom: blue500,
gradientTo: blue700,
Expand Down
5 changes: 5 additions & 0 deletions packages/wow-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
"require": "./dist/TextButton.cjs",
"import": "./dist/TextButton.js"
},
"./Tag": {
"types": "./dist/components/Tag/index.d.ts",
"require": "./dist/Tag.cjs",
"import": "./dist/Tag.js"
},
"./Switch": {
"types": "./dist/components/Switch/index.d.ts",
"require": "./dist/Switch.cjs",
Expand Down
1 change: 1 addition & 0 deletions packages/wow-ui/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default {
input: {
TextField: "./src/components/TextField",
TextButton: "./src/components/TextButton",
Tag: "./src/components/Tag",
Switch: "./src/components/Switch",
Stepper: "./src/components/Stepper",
BlueSpinner: "./src/components/Spinner/BlueSpinner",
Expand Down
91 changes: 91 additions & 0 deletions packages/wow-ui/src/components/Tag/Tag.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import type { Meta, StoryObj } from "@storybook/react";

import Tag from "@/components/Tag";

const meta = {
title: "UI/Tag",
component: Tag,
tags: ["autodocs"],
parameters: {
componentSubtitle: "태그 컴포넌트",
a11y: {
config: {
rules: [{ id: "color-contrast", enabled: false }],
},
},
},
argTypes: {
children: {
description: "태그의 자식 요소.",
table: {
type: { summary: "ReactNode" },
},
control: {
type: "text",
},
},
variant: {
description: "태그의 종류를 나타냅니다.",
table: {
type: { summary: "outline | solid1 | solid2" },
defaultValue: { summary: "outline" },
},
control: {
type: "radio",
options: ["outline", "solid1", "solid2"],
},
},
color: {
description: "태그의 색상을 나타냅니다.",
table: {
type: { summary: "red | blue | green | yellow | grey" },
},
control: {
type: "radio",
options: ["red", "blue", "green", "yellow", "grey"],
},
},
style: {
description: "태그의 커스텀 스타일을 나타냅니다.",
table: {
type: { summary: "CSSProperties" },
},
control: false,
},
className: {
description: "태그에 전달하는 커스텀 클래스를 나타냅니다.",
table: {
type: { summary: "string" },
},
control: false,
},
},
} satisfies Meta<typeof Tag>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Outline: Story = {
args: {
children: "Tag",
variant: "outline",
color: "blue",
},
};

export const Solid1: Story = {
args: {
children: "Tag",
variant: "solid1",
color: "blue",
},
};

export const Solid2: Story = {
args: {
children: "Tag",
variant: "solid2",
color: "blue",
},
};
Loading
Loading