-
Notifications
You must be signed in to change notification settings - Fork 0
Chore/Lucide-react #10
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bb251ec
CDP-28 choreโ๏ธ: develop PR CI ์ ๊ฑฐ
leeunduck 382ffc3
Chore/code style commit convention
leeunduck 41753e0
Merge branch 'main' into develop
leeunduck 103f47c
Chore/lucide react
leeunduck e85ee6b
Merge branch 'main' into develop
leeunduck 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| echo "๐ pre-commit: lint-staged ์คํ ๋ฐ ์ต์ข ์ ๊ฒ ์์" | ||
|
|
||
| # 0) ์ปค๋ฐ์ ํฌํจ๋ ํ์ผ ๋ชฉ๋ก (์ถ๊ฐ/๋ณต์ฌ/์์ ) | ||
| STAGED_FILES="$(git diff --name-only --cached --diff-filter=ACMR)" | ||
| if [ -z "$STAGED_FILES" ]; then | ||
| echo "โน๏ธ ์คํ ์ด์ง๋ ํ์ผ์ด ์์ต๋๋ค. ๊ฑด๋๋๋๋ค." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # 1) ๋ณ๊ฒฝ ํ์ผ๋ง ์๋ ์์ (eslint --fix, prettier --write) | ||
| if ! pnpm lint-staged; then | ||
| echo | ||
| echo "โ lint-staged ๋จ๊ณ์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค." | ||
| echo " - ์๋์์ ๋ถ๊ฐํ ๋ฆฐํธ ์๋ฌ๊ฐ ์์ ์ ์์ด์." | ||
| echo " - ๋ก์ปฌ์์ 'pnpm lint'๋ก ์๋ฌ๋ฅผ ํ์ธํ๊ณ ์์ ํ ๋ค ๋ค์ ์ปค๋ฐํ์ธ์." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # 2) ์ต์ข ์ ๊ฒ: ์คํ ์ด์ง๋ ํ์ผ๋ง ๋์์ผ๋ก ๊ฒ์ฌ(์์ ์์ด ์คํจ๋ง ๊ฐ์ง) | ||
| PRETTIER_FAIL=0 | ||
| ESLINT_FAIL=0 | ||
|
|
||
| # ๊ฐํ๋ง ๊ตฌ๋ถ์๋ก ์ฌ์ฉ (๊ณต๋ฐฑ ํฌํจ ํ์ผ๋ช ์์ ) | ||
| IFS="$(printf '\n')" | ||
| for f in $STAGED_FILES; do | ||
| case "$f" in | ||
| *.js|*.jsx|*.ts|*.tsx|*.json|*.css|*.md) | ||
| # Prettier ํฌ๋งท ์ค์ ํ์ธ (์์ ์์ด ๊ฒ์ฌ) | ||
| pnpm -s prettier --check "$f" || PRETTIER_FAIL=1 | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| for f in $STAGED_FILES; do | ||
| case "$f" in | ||
| *.js|*.jsx|*.ts|*.tsx) | ||
| # ESLint ์ต์ข ํ์ธ (์์ ์์ด ๊ฒ์ฌ) | ||
| pnpm -s eslint --max-warnings=0 "$f" || ESLINT_FAIL=1 | ||
| ;; | ||
| esac | ||
| done | ||
| unset IFS | ||
|
|
||
| if [ "$PRETTIER_FAIL" -ne 0 ]; then | ||
| echo | ||
| echo "โ Prettier ํฌ๋งท ์๋ฐ์ด ๋จ์ ์์ต๋๋ค." | ||
| echo " - 'pnpm format' ํ ๋ค์ ์ปค๋ฐํ์ธ์." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$ESLINT_FAIL" -ne 0 ]; then | ||
| echo | ||
| echo "โ ESLint ์๋ฐ์ด ๋จ์ ์์ต๋๋ค." | ||
| echo " - 'pnpm lint:fix' ๋๋ ์๋ ์์ ํ ๋ค์ ์ปค๋ฐํ์ธ์." | ||
| exit 1 | ||
| fi | ||
|
|
||
| COUNT="$(printf '%s\n' "$STAGED_FILES" | wc -l | tr -d ' ')" | ||
| echo "โ pre-commit ํต๊ณผ: ${COUNT}๊ฐ ํ์ผ ์ ๊ฒ ์๋ฃ" | ||
| exit 0 | ||
| pnpm lint-staged |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,80 @@ | ||
| import { | ||
| ArrowLeft, | ||
| ArrowRight, | ||
| Bell, | ||
| BellRing, | ||
| Calendar, | ||
| CalendarDays, | ||
| CalendarRange, | ||
| Check, | ||
| CheckSquare, | ||
| Clock, | ||
| Eye, | ||
| EyeOff, | ||
| Grid3X3, | ||
| HelpCircle, | ||
| Info, | ||
| Laptop, | ||
| Layout, | ||
| Mail, | ||
| Maximize, | ||
| Menu, | ||
| Minus, | ||
| Monitor, | ||
| Move, | ||
| Plus, | ||
| RotateCcw, | ||
| Search, | ||
| Settings, | ||
| Smartphone, | ||
| StickyNote, | ||
| UserPlus, | ||
| Users, | ||
| X, | ||
| } from "lucide-react"; | ||
|
|
||
| /** | ||
| * ์์ด์ฝ ๋ ์ง์คํธ๋ฆฌ | ||
| * - ํ์ํ Lucide ์์ด์ฝ๋ง import ํ ๊ฐ์ฒด๋ก ๋งคํ | ||
| * - key๋ ํ๋ก์ ํธ์์ ์ฌ์ฉํ ์ด๋ฆ (camelCase) | ||
| */ | ||
| export const icons = { | ||
| eye: Eye, | ||
| eyeOff: EyeOff, | ||
| check: Check, | ||
| x: X, | ||
| mail: Mail, | ||
| arrowLeft: ArrowLeft, | ||
| arrowRight: ArrowRight, | ||
| search: Search, | ||
| userPlus: UserPlus, | ||
| monitor: Monitor, | ||
| laptop: Laptop, | ||
| smartphone: Smartphone, | ||
| calendar: Calendar, | ||
| calendarDays: CalendarDays, | ||
| calendarRange: CalendarRange, | ||
| checkSquare: CheckSquare, | ||
| stickyNote: StickyNote, | ||
| rotateCcw: RotateCcw, | ||
| bell: Bell, | ||
| clock: Clock, | ||
| users: Users, | ||
| bellRing: BellRing, | ||
| settings: Settings, | ||
| menu: Menu, | ||
| info: Info, | ||
| helpCircle: HelpCircle, | ||
| minus: Minus, | ||
| plus: Plus, | ||
| grid3X3: Grid3X3, | ||
| layout: Layout, | ||
| move: Move, | ||
| maximize: Maximize, | ||
| } as const; | ||
|
|
||
| /** ์์ด์ฝ ์ด๋ฆ ํ์ */ | ||
| export type IconName = keyof typeof icons; | ||
|
|
||
| /** ์์ด์ฝ key ๋ฆฌ์คํธ (์: map ๋ ๋๋ง์ ํ์ฉ) */ | ||
| export const ICON_KEYS = Object.keys(icons) as IconName[]; |
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,18 @@ | ||
| import type { IconProps } from "@/types/icon"; | ||
| import clsx from "clsx"; | ||
| import { icons } from "./Icon.registry"; | ||
|
|
||
| export function Icon({ name, size = 24, strokeWidth = 2, label, className, ...rest }: IconProps) { | ||
| const Cmp = icons[name]; | ||
| return ( | ||
| <Cmp | ||
| size={size} | ||
| strokeWidth={strokeWidth} | ||
| color="currentColor" | ||
| className={clsx("text-gray-900", className)} | ||
| aria-label={label} | ||
| aria-hidden={label ? undefined : true} | ||
| {...rest} | ||
| /> | ||
| ); | ||
| } | ||
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,23 @@ | ||
| import type { IconName } from "@/shared/ui/Icon.registry"; | ||
| import type { Calendar } from "lucide-react"; | ||
| import type { ComponentProps } from "react"; | ||
|
|
||
| /** Lucide ์์ด์ฝ ๊ณตํต props */ | ||
| type LucideBaseProps = ComponentProps<typeof Calendar>; | ||
|
|
||
| /** | ||
| * ๊ณตํต Icon ์ปดํฌ๋ํธ Props | ||
| * - ์์์ Tailwind text-* ํด๋์ค๋ก ์ ์ด | ||
| * - color prop์ ์ ์ธํ๊ณ ํญ์ currentColor ์ฌ์ฉ | ||
| */ | ||
| export type IconProps = { | ||
| name: IconName; | ||
| /** ์คํฌ๋ฆฐ๋ฆฌ๋์ฉ ๋ผ๋ฒจ (์๊ฐ์ title ์๋) */ | ||
| label?: string; | ||
| /** ์์ด์ฝ ํฌ๊ธฐ (๊ธฐ๋ณธ 24) */ | ||
| size?: number; | ||
| /** ์ ๊ตต๊ธฐ (๊ธฐ๋ณธ 2) */ | ||
| strokeWidth?: number; | ||
| /** Tailwind ํด๋์ค์ ๊ฒฐํฉ ๊ฐ๋ฅ */ | ||
| className?: string; | ||
| } & Omit<LucideBaseProps, "ref" | "color">; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Mark Icon wrapper as a client component
The shared
Iconcomponent is meant to be a reusable wrapper around lucide icons, but the file does not start with'use client'. Next.js therefore treats this module as a server component, and any interactive component that tries to import it will fail to compile with โYouโre importing a component that needs to be rendered on the serverโฆโ. Since icons are commonly needed inside client components (buttons, inputs, etc.), this component should be marked as a client component so it can be imported safely from both server and client modules.Useful? React with ๐ย / ๐.