-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: JDS Code 컴포넌트 vanilla-extract 마이그레이션 #438
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b2eb111
rename: Code.types.ts → code.types.ts 파일명 변경
areumH fc8eb87
refactor: Code 컴포넌트 VE 마이그레이션
areumH 8a63c85
docs: Code 스토리 description 문구 수정
areumH 979a670
refactor: code.css.ts의 vars import를 상대 경로로 변경
areumH 5d5bc2f
refactor: code recipe의 defaultVariants 제거
areumH cf33979
style: code.css.ts import 순서 정리
areumH 382a351
refactor: Code 컴포넌트에 ref 전달 지원
areumH 0ed4501
refactor: Code import 정리
areumH File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,17 @@ | ||
| import { StyledCode } from "./Code.styles"; | ||
| import type { CodeProps } from "./Code.types"; | ||
| import { clsx } from "clsx"; | ||
| import { forwardRef } from "react"; | ||
|
|
||
| export const Code = ({ children, size = "md", className, ...restProps }: CodeProps) => { | ||
| return ( | ||
| <StyledCode $size={size} className={className} {...restProps}> | ||
| {children} | ||
| </StyledCode> | ||
| ); | ||
| }; | ||
| import * as styles from "./code.css"; | ||
| import type { CodeProps } from "./code.types"; | ||
|
|
||
| export const Code = forwardRef<HTMLElement, CodeProps>( | ||
| ({ children, size = "md", className, ...restProps }, ref) => { | ||
| return ( | ||
| <code ref={ref} className={clsx(styles.code({ size }), className)} {...restProps}> | ||
| {children} | ||
| </code> | ||
| ); | ||
| }, | ||
| ); | ||
|
|
||
| Code.displayName = "Code"; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { recipe } from "@vanilla-extract/recipes"; | ||
|
|
||
| import type { CodeSize } from "./code.types"; | ||
| import { vars } from "tokens"; | ||
|
|
||
| export const codeTypographyClassName: Record<CodeSize, string> = { | ||
| lg: "semantic-textStyle-syntax-lg", | ||
| md: "semantic-textStyle-syntax-md", | ||
| sm: "semantic-textStyle-syntax-sm", | ||
| xs: "semantic-textStyle-syntax-xs", | ||
| }; | ||
|
|
||
| export const code = recipe({ | ||
| base: { | ||
| display: "inline-flex", | ||
| alignItems: "center", | ||
| padding: `${vars.scheme.semantic.spacing["0"]} ${vars.scheme.semantic.spacing["6"]}`, | ||
| borderRadius: vars.scheme.semantic.radius["4"], | ||
| background: vars.color.semantic.fill.subtlest, | ||
| border: `1px solid ${vars.color.semantic.stroke.alpha.assistive}`, | ||
| color: vars.color.semantic.object.bold, | ||
| cursor: "text", | ||
| }, | ||
| variants: { | ||
| size: codeTypographyClassName, | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import type { ComponentPropsWithoutRef, ReactNode } from "react"; | ||
|
|
||
| export type CodeSize = "lg" | "md" | "sm" | "xs"; | ||
|
|
||
| export interface CodeProps extends ComponentPropsWithoutRef<"code"> { | ||
| children: ReactNode; | ||
| size?: CodeSize; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| export * from "./Code"; | ||
| export * from "./Code.types"; | ||
| export * from "./code.types"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.