Skip to content

Commit

Permalink
docs: CodeBlock 컴포넌트 문서화
Browse files Browse the repository at this point in the history
  • Loading branch information
yunchaehyun committed Feb 24, 2024
1 parent 7167083 commit 11e0c72
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/components/CodeBlock/CodeBlock.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Meta, StoryObj } from "@storybook/react";

import { CodeBlock } from "./CodeBlock";

const meta: Meta<typeof CodeBlock> = {
title: "CodeBlock",
tags: ["autodocs"],
component: CodeBlock,
};

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

export const Variants: Story = {
args: {
code: ["`git` add README.md"],
},
};
2 changes: 2 additions & 0 deletions src/components/CodeBlock/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { container } from "./CodeBlock.css";

interface CodeBlockProps {
/** 코드 블록 내부 코드의 내용입니다. 배열 요소별로 줄바꿈이 적용됩니다. */
code: string[];
className?: string;
}

/** CodeBlock은 코드 블록의 용도로 사용되는 컴포넌트입니다. 코드 블록 요소 내부에 있는 백틱(``)으로 감싸진 부분에 코드 하이라이팅이 적용됩니다. */
export function CodeBlock({ code, className = "" }: CodeBlockProps) {
return (
<p
Expand Down

0 comments on commit 11e0c72

Please sign in to comment.