Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b2afea5
feat(66): 폴리모픽 컴포넌트 타입 정의 추가
Seojunhwan Jul 4, 2025
49fd419
feat(66): CSS 유틸리티 함수 추가 - rem 값 변환 및 CSS 변수 가져오기
Seojunhwan Jul 4, 2025
1c6dbe3
feat(66): 블리드 컴포넌트 및 스타일 추가, 스토리북 예제 포함
Seojunhwan Jul 4, 2025
56df41d
feat(66): Spacer 컴포넌트 추가 및 스토리북 예제 작성
Seojunhwan Jul 4, 2025
168430b
feat(66): Stack 컴포넌트 및 스타일 추가, 스토리북 예제 포함
Seojunhwan Jul 4, 2025
8ee484e
feat(66): Text 컴포넌트 및 스타일 추가, 스토리북 예제 포함
Seojunhwan Jul 4, 2025
73c146e
refactor(66): getVar 함수 삭제 - 사용되지 않음
Seojunhwan Jul 4, 2025
e38a465
refactor(66): CSS 변수 생성 및 사용 방식 변경 - createVar()로 대체
Seojunhwan Jul 4, 2025
847fc94
fix(66): coerceCssRemValue 함수 수정 - rem 변환 로직을 1rem = 10px에 맞게 조정
Seojunhwan Jul 4, 2025
e1ba829
chore(66): @vanilla-extract/dynamic 패키지 추가 및 browserslist 버전 업데이트
Seojunhwan Jul 4, 2025
dd7cea8
docs(66): Spacer 컴포넌트의 방향 속성 제거 - 기본 방향으로 설정
Seojunhwan Jul 4, 2025
7fc2154
feat(66): Stack 컴포넌트에 Stack 내보내기 추가 및 export 수정
Seojunhwan Jul 4, 2025
7c80156
docs(66): Bleed, Spacer, Stack, Text 컴포넌트의 스토리북 예제 및 문서 개선
Seojunhwan Jul 4, 2025
b88ec86
refactor(66): Bleed 컴포넌트의 스타일 객체 생성 방식을 개선하여 가독성 향상
Seojunhwan Jul 6, 2025
c27096a
refactor(66): PolymorphicComponentPropsWithRef 타입을 polymorphic.types.…
Seojunhwan Jul 6, 2025
32dd9e5
refactor(66): Polymorphic 타입의 import 경로를 수정, StackProps에서 direction 속…
Seojunhwan Jul 6, 2025
db55ec1
refactor(66): Text 컴포넌트의 import 경로를 간소화하여 코드 가독성 향상
Seojunhwan Jul 6, 2025
3796eda
refactor(66): namespace import로 변경
Seojunhwan Jul 6, 2025
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@tanstack/react-query": "^5.77.0",
"@tanstack/react-query-devtools": "^5.77.0",
"@vanilla-extract/css": "^1.17.2",
"@vanilla-extract/dynamic": "^2.1.5",
"@vanilla-extract/recipes": "^0.5.7",
"iron-session": "^8.0.4",
"ky": "^1.8.1",
Expand Down
12 changes: 11 additions & 1 deletion pnpm-lock.yaml

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

13 changes: 13 additions & 0 deletions src/components/ui/Bleed/Bleed.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createVar, style } from "@vanilla-extract/css";

export const bleedInlineStartVar = createVar();
export const bleedInlineEndVar = createVar();
export const bleedBlockStartVar = createVar();
export const bleedBlockEndVar = createVar();

export const container = style({
marginInlineStart: `calc(${bleedInlineStartVar} * -1)`,
marginInlineEnd: `calc(${bleedInlineEndVar} * -1)`,
marginBlockStart: `calc(${bleedBlockStartVar} * -1)`,
marginBlockEnd: `calc(${bleedBlockEndVar} * -1)`,
});
206 changes: 206 additions & 0 deletions src/components/ui/Bleed/Bleed.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Bleed } from "./Bleed";

const meta: Meta<typeof Bleed> = {
title: "Components/Bleed",
component: Bleed,
tags: ["autodocs"],
parameters: {
docs: {
description: {
component:
"Bleed 컴포넌트는 부모 요소의 여백(padding)을 무시하고 특정 방향으로 확장되어야 하는 UI를 구현할 때 사용됩니다. 이를 통해 페이지나 섹션의 전체 너비를 차지하는 컴포넌트를 쉽게 만들 수 있습니다.",
},
},
},
argTypes: {
as: {
control: false,
description: "컴포넌트의 HTML 태그를 설정합니다.",
table: {
type: { summary: "React.ElementType" },
defaultValue: { summary: "div" },
},
},
inline: {
control: "number",
description:
"좌우 여백을 설정합니다. `inlineStart`와 `inlineEnd`를 동시에 설정합니다.",
table: {
type: { summary: "number | string" },
},
},
block: {
control: "number",
description:
"상하 여백을 설정합니다. `blockStart`와 `blockEnd`를 동시에 설정합니다.",
table: {
type: { summary: "number | string" },
},
},
inlineStart: {
control: "number",
description: "시작 방향(LTR 환경에서는 왼쪽)의 여백을 설정합니다.",
table: {
type: { summary: "number | string" },
},
},
inlineEnd: {
control: "number",
description: "끝 방향(LTR 환경에서는 오른쪽)의 여백을 설정합니다.",
table: {
type: { summary: "number | string" },
},
},
blockStart: {
control: "number",
description: "위쪽 여백을 설정합니다.",
table: {
type: { summary: "number | string" },
},
},
blockEnd: {
control: "number",
description: "아래쪽 여백을 설정합니다.",
table: {
type: { summary: "number | string" },
},
},
},
};

export default meta;
type Story = StoryObj<typeof Bleed>;

export const InlineBleed: Story = {
render: () => (
<div
style={{
padding: "16px",
backgroundColor: "rgba(255, 0, 0, 0.1)",
width: "300px",
}}
>
<div
style={{
backgroundColor: "rgba(0, 255, 0, 0.1)",
padding: "12px",
textAlign: "center",
}}
>
컨텐츠 영역
</div>
<Bleed inline={16}>
<div
style={{
backgroundColor: "rgba(0, 0, 255, 0.1)",
padding: "12px",
textAlign: "center",
}}
>
Bleed 영역
</div>
</Bleed>
<div
style={{
backgroundColor: "rgba(0, 255, 0, 0.1)",
padding: "12px",
textAlign: "center",
marginTop: "8px",
}}
>
컨텐츠 영역
</div>
</div>
),
parameters: {
docs: {
description: {
story:
"`inline` prop을 사용하여 좌우로 확장된 컴포넌트입니다. 부모 요소의 `padding`을 무시하고 좌우로 확장됩니다. 붉은 영역이 부모의 padding 영역을 시각화합니다.",
},
},
},
};

export const BlockBleed: Story = {
render: () => (
<div
style={{
padding: "16px",
backgroundColor: "rgba(255, 0, 0, 0.1)",
}}
>
<div
style={{
backgroundColor: "rgba(0, 255, 0, 0.1)",
padding: "12px",
textAlign: "center",
}}
>
컨텐츠 영역
</div>
<Bleed block={16}>
<div
style={{
backgroundColor: "rgba(0, 0, 255, 0.1)",
padding: "12px",
textAlign: "center",
}}
>
Bleed 영역
</div>
</Bleed>
<div
style={{
backgroundColor: "rgba(0, 255, 0, 0.1)",
padding: "12px",
textAlign: "center",
marginTop: "8px",
}}
>
컨텐츠 영역
</div>
</div>
),
parameters: {
docs: {
description: {
story:
"`block` prop을 사용하여 상하로 확장된 컴포넌트입니다. 부모 요소의 `padding`을 무시하고 상하로 확장됩니다. 붉은 영역이 부모의 padding 영역을 시각화합니다.",
},
},
},
};

export const AllDirectionsBleed: Story = {
render: () => (
<div
style={{
padding: "16px",
backgroundColor: "rgba(255, 0, 0, 0.1)",
}}
>
<Bleed inline={16} block={16}>
<div
style={{
backgroundColor: "rgba(0, 0, 255, 0.1)",
padding: "12px",
textAlign: "center",
}}
>
Bleed 영역
</div>
</Bleed>
</div>
),
parameters: {
docs: {
description: {
story:
"`inline`과 `block` prop을 모두 사용하여 모든 방향으로 확장된 컴포넌트입니다.",
},
},
},
};
69 changes: 69 additions & 0 deletions src/components/ui/Bleed/Bleed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { assignInlineVars } from "@vanilla-extract/dynamic";
import { type ElementType } from "react";

import { coerceCssRemValue } from "@/lib/utils/coerceCssRemValue";
import { type PolymorphicComponentPropsWithRef } from "@/types/polymorphic.types";

import * as styles from "./Bleed.css";

export type BleedProps<T extends ElementType> =
PolymorphicComponentPropsWithRef<
T,
{
inline?: number | string;
block?: number | string;
inlineStart?: number | string;
inlineEnd?: number | string;
blockStart?: number | string;
blockEnd?: number | string;
}
>;

export const Bleed = <T extends ElementType = "div">({
as,
className,
inline,
block,
inlineStart,
inlineEnd,
blockStart,
blockEnd,
style: styleFromProps,
...props
}: BleedProps<T>) => {
const Component = as || "div";

const style = {
...styleFromProps,
...assignInlineVars({
...(inline && {
[styles.bleedInlineStartVar]: coerceCssRemValue(inline),
[styles.bleedInlineEndVar]: coerceCssRemValue(inline),
}),
...(block && {
[styles.bleedBlockStartVar]: coerceCssRemValue(block),
[styles.bleedBlockEndVar]: coerceCssRemValue(block),
}),
...(inlineStart && {
[styles.bleedInlineStartVar]: coerceCssRemValue(inlineStart),
}),
...(inlineEnd && {
[styles.bleedInlineEndVar]: coerceCssRemValue(inlineEnd),
}),
...(blockStart && {
[styles.bleedBlockStartVar]: coerceCssRemValue(blockStart),
}),
...(blockEnd && {
[styles.bleedBlockEndVar]: coerceCssRemValue(blockEnd),
}),
}),
};

return (
<Component
className={`${styles.container} ${className ?? ""}`.trim()}
style={style}
{...props}
/>
);
};
1 change: 1 addition & 0 deletions src/components/ui/Bleed/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Bleed, type BleedProps } from "./Bleed";
Loading