Skip to content

Commit

Permalink
Merge branch 'wip' into feat-stackflow-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
malangcat committed Dec 24, 2024
2 parents bc568f1 + b30e18e commit 8aa76bf
Show file tree
Hide file tree
Showing 50 changed files with 1,265 additions and 166 deletions.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion docs/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji";
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body.sb-show-main.sb-main-padded {
Expand Down Expand Up @@ -45,4 +46,4 @@
"ios"
);
</script>
</head>
</head>
5 changes: 5 additions & 0 deletions docs/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,8 @@
.dark #nd-sidebar {
--muted: 0deg 0% 16%;
}

.example-reset {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}
2 changes: 1 addition & 1 deletion docs/components/component-example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function ComponentExample(props: ComponentExampleProps) {
<Tab value="미리보기">
<React.Suspense fallback={null}>
<div
className="not-prose"
className="not-prose example-reset"
style={{
minHeight: "300px",
width: "100%",
Expand Down
5 changes: 5 additions & 0 deletions docs/components/example/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@
"progress-circle-preview": "import { ProgressCircle } from \"seed-design/ui/progress-circle\";\n\nexport default function ProgressCirclePreview() {\n return <ProgressCircle tone=\"neutral\" size=\"40\" />;\n}",
"progress-circle-small": "import { ProgressCircle } from \"seed-design/ui/progress-circle\";\n\nexport default function ProgressCirclePreview() {\n return <ProgressCircle size=\"40\" />;\n}",
"progress-circle-static-white": "import { ProgressCircle } from \"seed-design/ui/progress-circle\";\n\nexport default function ProgressCircleStaticWhite() {\n return (\n <div\n style={{\n display: \"flex\",\n flex: 1,\n width: \"100%\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"#000\",\n }}\n >\n <ProgressCircle tone=\"staticWhite\" />\n </div>\n );\n}",
"reaction-button-disabled": "import { IconFaceSmileCircleFill } from \"@daangn/react-monochrome-icon\";\nimport { ReactionButton } from \"seed-design/ui/reaction-button\";\n\nexport default function ReactionButtonDisabled() {\n return (\n <ReactionButton prefixIcon={<IconFaceSmileCircleFill />} disabled>\n 비활성\n </ReactionButton>\n );\n}",
"reaction-button-loading": "import { IconFaceSmileCircleFill } from \"@daangn/react-monochrome-icon\";\nimport { useState } from \"react\";\nimport { ReactionButton } from \"seed-design/ui/reaction-button\";\n\nexport default function ReactionButtonLoading() {\n const [pressed, setPressed] = useState(false);\n const [loading, setLoading] = useState(false);\n\n function handleToggle() {\n setLoading(true);\n setTimeout(() => {\n setLoading(false);\n setPressed((prev) => !prev);\n }, 2000);\n }\n\n // 이벤트 핸들링이 필요할 수 있으므로 loading은 disabled를 포함하지 않습니다. 이벤트 발생을 원하지 않는 경우, disabled 속성을 추가해주세요.\n return (\n <ReactionButton\n prefixIcon={<IconFaceSmileCircleFill />}\n loading={loading}\n pressed={pressed}\n onPressedChange={handleToggle}\n >\n 시간이 걸리는 토글\n </ReactionButton>\n );\n}",
"reaction-button-preview": "import { IconFaceSmileCircleFill } from \"@daangn/react-monochrome-icon\";\nimport { ReactionButton } from \"seed-design/ui/reaction-button\";\n\nexport default function ReactionButtonPreview() {\n return (\n <ReactionButton prefixIcon={<IconFaceSmileCircleFill />} count={1}>\n 도움돼요\n </ReactionButton>\n );\n}",
"reaction-button-small": "import { IconFaceSmileCircleFill } from \"@daangn/react-monochrome-icon\";\nimport { ReactionButton } from \"seed-design/ui/reaction-button\";\n\nexport default function ReactionButtonSmall() {\n return (\n <ReactionButton prefixIcon={<IconFaceSmileCircleFill />} size=\"small\" count={1}>\n 도움돼요\n </ReactionButton>\n );\n}",
"reaction-button-xsmall": "import { IconFaceSmileCircleFill } from \"@daangn/react-monochrome-icon\";\nimport { ReactionButton } from \"seed-design/ui/reaction-button\";\n\nexport default function ReactionButtonXsmall() {\n return (\n <ReactionButton prefixIcon={<IconFaceSmileCircleFill />} size=\"xsmall\" count={1}>\n 도움돼요\n </ReactionButton>\n );\n}",
"segmented-control-disabled": "import { SegmentedControl, Segment } from \"seed-design/ui/segmented-control\";\n\nexport default function SegmentedControlPreview() {\n return (\n <SegmentedControl defaultValue=\"Hot\" disabled>\n <Segment value=\"Hot\">Hot</Segment>\n <Segment value=\"New\">New</Segment>\n </SegmentedControl>\n );\n}",
"segmented-control-fixed-width": "import { SegmentedControl, Segment } from \"seed-design/ui/segmented-control\";\n\nexport default function SegmentedControlFixedWidth() {\n return (\n <SegmentedControl defaultValue=\"new\">\n <Segment value=\"new\">New</Segment>\n <Segment value=\"hot\">Hot</Segment>\n </SegmentedControl>\n );\n}",
"segmented-control-long-label-fixed-width": "import { SegmentedControl, Segment } from \"seed-design/ui/segmented-control\";\n\nexport default function SegmentedControlLongLabelFixedWidth() {\n return (\n <SegmentedControl defaultValue=\"price\">\n <Segment value=\"price\">가격 높은 순</Segment>\n <Segment value=\"discount\">할인율 높은 순</Segment>\n <Segment value=\"popularity\">인기 많은 순</Segment>\n </SegmentedControl>\n );\n}",
Expand Down
10 changes: 10 additions & 0 deletions docs/components/example/reaction-button-disabled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IconFaceSmileCircleFill } from "@daangn/react-monochrome-icon";
import { ReactionButton } from "seed-design/ui/reaction-button";

export default function ReactionButtonDisabled() {
return (
<ReactionButton prefixIcon={<IconFaceSmileCircleFill />} disabled>
비활성
</ReactionButton>
);
}
30 changes: 30 additions & 0 deletions docs/components/example/reaction-button-loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client";

import { IconFaceSmileCircleFill } from "@daangn/react-monochrome-icon";
import { useState } from "react";
import { ReactionButton } from "seed-design/ui/reaction-button";

export default function ReactionButtonLoading() {
const [pressed, setPressed] = useState(false);
const [loading, setLoading] = useState(false);

function handleToggle() {
setLoading(true);
setTimeout(() => {
setLoading(false);
setPressed((prev) => !prev);
}, 2000);
}

// 이벤트 핸들링이 필요할 수 있으므로 loading은 disabled를 포함하지 않습니다. 이벤트 발생을 원하지 않는 경우, disabled 속성을 추가해주세요.
return (
<ReactionButton
prefixIcon={<IconFaceSmileCircleFill />}
loading={loading}
pressed={pressed}
onPressedChange={handleToggle}
>
시간이 걸리는 토글
</ReactionButton>
);
}
10 changes: 10 additions & 0 deletions docs/components/example/reaction-button-preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IconFaceSmileCircleFill } from "@daangn/react-monochrome-icon";
import { ReactionButton } from "seed-design/ui/reaction-button";

export default function ReactionButtonPreview() {
return (
<ReactionButton prefixIcon={<IconFaceSmileCircleFill />} count={1}>
도움돼요
</ReactionButton>
);
}
10 changes: 10 additions & 0 deletions docs/components/example/reaction-button-small.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IconFaceSmileCircleFill } from "@daangn/react-monochrome-icon";
import { ReactionButton } from "seed-design/ui/reaction-button";

export default function ReactionButtonSmall() {
return (
<ReactionButton prefixIcon={<IconFaceSmileCircleFill />} size="small" count={1}>
도움돼요
</ReactionButton>
);
}
10 changes: 10 additions & 0 deletions docs/components/example/reaction-button-xsmall.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IconFaceSmileCircleFill } from "@daangn/react-monochrome-icon";
import { ReactionButton } from "seed-design/ui/reaction-button";

export default function ReactionButtonXsmall() {
return (
<ReactionButton prefixIcon={<IconFaceSmileCircleFill />} size="xsmall" count={1}>
도움돼요
</ReactionButton>
);
}
31 changes: 31 additions & 0 deletions docs/content/docs/design/components/reaction-button.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Reaction Button
description: TBD
---

<SanityGuideline title="Reaction Button" />

## 옵션 테이블

| 속성 || 기본값 |
| ----------- | ------------------------- | --------- |
| size | xsmall, small | small |
| disabled | true, false | false |
| loading | true, false | false |
| prefix icon | icon | |
| count | number | |

## 링크

<Cards>
<Card
icon={<AtomIcon />}
title="React"
description="Reaction Button 컴포넌트를 React로 사용하는 방법을 설명합니다."
href="/docs/react/components/reaction-button"
/>
</Cards>

## Spec

<ComponentSpecBlock id="reaction-button" />
31 changes: 31 additions & 0 deletions docs/content/docs/react/components/reaction-button.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Reaction Button
---

<ComponentExample name="reaction-button-preview" />

## 설치

<Installation name="reaction-button" />

## Props

<ReactTypeTable path="./registry/ui/reaction-button.tsx" name="ReactionButtonProps" />

## 예제

### Small

<ComponentExample name="reaction-button-small" />

### Xsmall

<ComponentExample name="reaction-button-xsmall" />

### Disabled

<ComponentExample name="reaction-button-disabled" />

### Loading

<ComponentExample name="reaction-button-loading" />
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@daangn/icon-data": "^0.0.18",
"@daangn/react-monochrome-icon": "^0.0.13",
"@daangn/icon-data": "^0.0.19",
"@daangn/react-monochrome-icon": "^0.0.14",
"@daangn/react-multicolor-icon": "^0.0.12",
"@next/env": "^15.0.4",
"@portabletext/react": "^3.1.0",
Expand Down
10 changes: 10 additions & 0 deletions docs/public/__registry__/ui/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@
"ui:toggle-button.tsx"
]
},
{
"name": "reaction-button",
"dependencies": [
"@radix-ui/react-slot",
"@seed-design/react-toggle"
],
"files": [
"ui:reaction-button.tsx"
]
},
{
"name": "fab",
"dependencies": [
Expand Down
14 changes: 14 additions & 0 deletions docs/public/__registry__/ui/reaction-button.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "reaction-button",
"dependencies": [
"@radix-ui/react-slot",
"@seed-design/react-toggle"
],
"registries": [
{
"name": "reaction-button.tsx",
"type": "ui",
"content": "\"use client\";\n\nimport \"@seed-design/stylesheet/progressCircle.css\";\nimport \"@seed-design/stylesheet/reactionButton.css\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { useToggle, type UseToggleProps } from \"@seed-design/react-toggle\";\nimport {\n reactionButton,\n type ReactionButtonVariantProps,\n} from \"@seed-design/recipe/reactionButton\";\nimport clsx from \"clsx\";\nimport * as React from \"react\";\nimport { ProgressCircle } from \"./progress-circle\";\n\nexport interface ReactionButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n UseToggleProps,\n ReactionButtonVariantProps {\n prefixIcon?: React.ReactNode;\n\n count?: number;\n\n loading?: boolean;\n\n /**\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * @see https://v3.seed-design.io/docs/react/components/reaction-button\n */\nexport const ReactionButton = React.forwardRef<\n HTMLButtonElement,\n ReactionButtonProps\n>(\n (\n {\n className,\n size = \"small\",\n children,\n prefixIcon,\n count,\n loading = false,\n asChild = false,\n ...otherProps\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"button\";\n const { rootProps, stateProps, restProps } = useToggle(otherProps);\n const classNames = reactionButton({ size });\n const dataProps = {\n ...stateProps,\n \"data-loading\": loading ? \"\" : undefined,\n };\n\n return (\n <Comp\n ref={ref}\n className={clsx(classNames.root, className)}\n {...dataProps}\n {...rootProps}\n {...restProps}\n >\n {prefixIcon && (\n <Slot aria-hidden {...dataProps} className={classNames.prefixIcon}>\n {prefixIcon}\n </Slot>\n )}\n <span {...dataProps} className={classNames.label}>\n {children}\n </span>\n <span {...dataProps} className={classNames.count}>\n {count}\n </span>\n {loading ? (\n <ProgressCircle\n {...dataProps}\n className={classNames.progressCircle}\n />\n ) : null}\n </Comp>\n );\n },\n);\nReactionButton.displayName = \"ReactionButton\";\n"
}
]
}
5 changes: 2 additions & 3 deletions docs/public/rootage/components/checkbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"base": {
"enabled": {
"label": {
"color": "$color.fg.neutral",
"lineHeight": "$line-height.s5"
"color": "$color.fg.neutral"
},
"root": {
"gap": "$unit.s2"
Expand Down Expand Up @@ -111,7 +110,7 @@
"size=small": {
"enabled": {
"root": {
"minHeight": "$unit.s8"
"minHeight": "$unit.s7"
},
"label": {
"fontSize": "$font-size.s3",
Expand Down
141 changes: 141 additions & 0 deletions docs/public/rootage/components/reaction-button.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"kind": "ComponentSpec",
"metadata": {
"id": "reaction-button",
"name": "Reaction Button"
},
"data": {
"base": {
"enabled": {
"root": {
"color": "$color.bg.neutral-weak",
"colorDuration": "$duration.s4",
"colorTimingFunction": "$timing-function.easing"
},
"label": {
"color": "$color.fg.neutral",
"fontWeight": "$font-weight.medium"
},
"count": {
"color": "$color.fg.neutral",
"fontWeight": "$font-weight.bold"
},
"prefixIcon": {
"color": "$color.fg.neutral"
},
"progressCircle": {
"trackColor": "$color.palette.gray-500",
"rangeColor": "$color.fg.neutral"
}
},
"pressed": {
"root": {
"color": "$color.bg.neutral-weak-pressed"
}
},
"selected": {
"root": {
"color": "$color.bg.layer-default",
"strokeColor": "$color.stroke.brand",
"strokeWidth": "1px"
},
"label": {
"color": "$color.fg.brand"
},
"count": {
"color": "$color.fg.brand"
},
"prefixIcon": {
"color": "$color.fg.brand"
},
"progressCircle": {
"trackColor": "$color.palette.carrot-200",
"rangeColor": "$color.fg.brand"
}
},
"selected,pressed": {
"root": {
"color": "$color.bg.layer-default-pressed"
}
},
"disabled": {
"root": {
"color": "$color.bg.disabled",
"strokeWidth": "0px"
},
"label": {
"color": "$color.fg.disabled"
},
"count": {
"color": "$color.fg.disabled"
},
"prefixIcon": {
"color": "$color.fg.disabled"
}
},
"loading": {
"root": {
"color": "$color.bg.neutral-weak-pressed"
}
},
"selected,loading": {
"root": {
"color": "$color.bg.layer-default-pressed",
"strokeWidth": "1px"
}
}
},
"size=xsmall": {
"enabled": {
"root": {
"minHeight": "$unit.s8",
"cornerRadius": "$radius.full",
"gap": "$unit.s1",
"paddingX": "$unit.s3",
"paddingY": "$unit.s1_5"
},
"prefixIcon": {
"size": "18px"
},
"label": {
"fontSize": "$font-size.s3",
"lineHeight": "$line-height.s3"
},
"count": {
"fontSize": "$font-size.s3",
"lineHeight": "$line-height.s3"
},
"progressCircle": {
"size": "14px",
"thickness": "2px"
}
}
},
"size=small": {
"enabled": {
"root": {
"minHeight": "$unit.s9",
"cornerRadius": "$radius.full",
"gap": "$unit.s1",
"paddingX": "$unit.s3_5",
"paddingY": "$unit.s2"
},
"prefixIcon": {
"size": "18px"
},
"label": {
"fontSize": "$font-size.s3",
"lineHeight": "$line-height.s3"
},
"count": {
"fontSize": "$font-size.s3",
"lineHeight": "$line-height.s3"
},
"progressCircle": {
"size": "14px",
"thickness": "2px"
}
}
}
}
}
Loading

0 comments on commit 8aa76bf

Please sign in to comment.