@nextlevel_korea/design-system 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,6 +25,185 @@ function App() {
25
25
  }
26
26
  ```
27
27
 
28
+ ## ⚠️ 중요: 스타일 적용 방법
29
+
30
+ 이 라이브러리를 사용할 때 **반드시 스타일을 import**해야 합니다:
31
+
32
+ ### 방법 1: CSS 파일 직접 import (권장)
33
+
34
+ ```tsx
35
+ import { Header } from '@nextlevel_korea/design-system';
36
+ import '@nextlevel_korea/design-system/styles'; // 이 줄이 필수입니다!
37
+
38
+ function App() {
39
+ return <Header logo="https://example.com/logo.png" />;
40
+ }
41
+ ```
42
+
43
+ ### 방법 2: 전역 CSS 파일에서 import
44
+
45
+ ```css
46
+ /* styles.css */
47
+ @import '@nextlevel_korea/design-system/styles';
48
+ ```
49
+
50
+ ### 방법 3: Next.js에서 사용
51
+
52
+ ```tsx
53
+ // pages/_app.tsx 또는 app/layout.tsx
54
+ import '@nextlevel_korea/design-system/styles';
55
+
56
+ export default function App({ Component, pageProps }) {
57
+ return <Component {...pageProps} />;
58
+ }
59
+ ```
60
+
61
+ ### 방법 4: Vite에서 사용
62
+
63
+ ```tsx
64
+ // main.tsx
65
+ import '@nextlevel_korea/design-system/styles';
66
+ import { Header } from '@nextlevel_korea/design-system';
67
+ ```
68
+
69
+ ## 🔧 문제 해결
70
+
71
+ ### 스타일이 적용되지 않는 경우
72
+
73
+ #### 1. 스타일 import 확인
74
+
75
+ 가장 일반적인 문제는 스타일을 import하지 않는 것입니다:
76
+
77
+ ```tsx
78
+ // ❌ 잘못된 사용법
79
+ import { Header } from '@nextlevel_korea/design-system';
80
+ // 스타일 import가 없음!
81
+
82
+ // ✅ 올바른 사용법
83
+ import { Header } from '@nextlevel_korea/design-system';
84
+ import '@nextlevel_korea/design-system/styles'; // 필수!
85
+ ```
86
+
87
+ #### 2. Tailwind CSS 충돌 해결
88
+
89
+ 프로젝트에 Tailwind CSS가 이미 설치되어 있는 경우:
90
+
91
+ ```js
92
+ // tailwind.config.js
93
+ module.exports = {
94
+ content: [
95
+ './src/**/*.{js,ts,jsx,tsx}',
96
+ './node_modules/@nextlevel_korea/design-system/dist/**/*.js', // 이 줄 추가
97
+ ],
98
+ // 라이브러리의 커스텀 색상을 추가
99
+ theme: {
100
+ extend: {
101
+ colors: {
102
+ success: '#22c55e',
103
+ warning: '#eab308',
104
+ danger: '#ef4444',
105
+ info: '#0ea5e9',
106
+ muted: '#6b7280',
107
+ },
108
+ },
109
+ },
110
+ };
111
+ ```
112
+
113
+ #### 3. CSS 우선순위 문제
114
+
115
+ 다른 CSS가 라이브러리 스타일을 덮어쓰는 경우:
116
+
117
+ ```css
118
+ /* styles.css */
119
+ /* 라이브러리 스타일을 먼저 import */
120
+ @import '@nextlevel_korea/design-system/styles';
121
+
122
+ /* 그 다음에 프로젝트 스타일 */
123
+ @import './your-styles.css';
124
+ ```
125
+
126
+ #### 4. 번들러 설정 확인
127
+
128
+ **Vite에서 사용 시:**
129
+
130
+ ```ts
131
+ // vite.config.ts
132
+ export default defineConfig({
133
+ optimizeDeps: {
134
+ include: ['@nextlevel_korea/design-system'],
135
+ },
136
+ });
137
+ ```
138
+
139
+ **Webpack에서 사용 시:**
140
+
141
+ ```js
142
+ // webpack.config.js
143
+ module.exports = {
144
+ resolve: {
145
+ alias: {
146
+ '@nextlevel_korea/design-system': require.resolve(
147
+ '@nextlevel_korea/design-system'
148
+ ),
149
+ },
150
+ },
151
+ };
152
+ ```
153
+
154
+ #### 5. TypeScript 설정 확인
155
+
156
+ ```json
157
+ // tsconfig.json
158
+ {
159
+ "compilerOptions": {
160
+ "moduleResolution": "node",
161
+ "esModuleInterop": true,
162
+ "allowSyntheticDefaultImports": true
163
+ }
164
+ }
165
+ ```
166
+
167
+ ### 일반적인 오류와 해결책
168
+
169
+ #### 오류: "Cannot resolve module '@nextlevel_korea/design-system/styles'"
170
+
171
+ ```bash
172
+ # 패키지 재설치
173
+ npm uninstall @nextlevel_korea/design-system
174
+ npm install @nextlevel_korea/design-system
175
+ ```
176
+
177
+ #### 오류: "Module not found"
178
+
179
+ ```bash
180
+ # node_modules 삭제 후 재설치
181
+ rm -rf node_modules package-lock.json
182
+ npm install
183
+ ```
184
+
185
+ #### 스타일이 일부만 적용되는 경우
186
+
187
+ Tailwind CSS의 purge 설정을 확인하세요:
188
+
189
+ ```js
190
+ // tailwind.config.js
191
+ module.exports = {
192
+ content: [
193
+ './src/**/*.{js,ts,jsx,tsx}',
194
+ './node_modules/@nextlevel_korea/design-system/dist/**/*.js',
195
+ ],
196
+ // safelist 추가 (필요한 경우)
197
+ safelist: [
198
+ 'text-success',
199
+ 'text-warning',
200
+ 'text-danger',
201
+ 'text-info',
202
+ 'text-muted',
203
+ ],
204
+ };
205
+ ```
206
+
28
207
  ## 📖 Storybook 문서
29
208
 
30
209
  우리 디자인 시스템을 탐색하고 이해하는 가장 좋은 방법은 인터랙티브 Storybook 문서를 통하는 것입니다.
@@ -65,15 +244,29 @@ npm run storybook
65
244
  커스터마이징 가능한 로고가 있는 유연한 헤더 컴포넌트입니다.
66
245
 
67
246
  ```tsx
68
- import { Header } from '@nextlevel/design-system';
247
+ import { Header } from '@nextlevel_korea/design-system';
248
+ import '@nextlevel_korea/design-system/styles'; // 필수!
69
249
 
70
250
  // 기본 사용법
71
- <Header logo="https://example.com/logo.png" />;
251
+ <Header logo="https://example.com/logo.png" title="My App" />
252
+
253
+ // 로고만 있는 헤더
254
+ <Header logo="https://example.com/logo.png" />
255
+
256
+ // 제목만 있는 헤더
257
+ <Header title="My Application" />
72
258
  ```
73
259
 
74
260
  **Props:**
75
261
 
76
- - `logo` (string) - 로고 이미지 URL
262
+ - `logo` (string, optional) - 로고 이미지 URL
263
+ - `title` (string, optional) - 헤더 제목
264
+
265
+ **스타일 클래스:**
266
+
267
+ - `flex items-center justify-between` - 기본 레이아웃
268
+ - `h-8` - 로고 높이
269
+ - `text-xl text-success font-bold` - 제목 스타일
77
270
 
78
271
  **Storybook 예제:**
79
272
 
@@ -214,3 +407,85 @@ MIT 라이선스 - 자세한 내용은 [LICENSE](LICENSE) 파일을 참조하세
214
407
  ---
215
408
 
216
409
  NextLevel 팀이 ❤️로 만들었습니다
410
+
411
+ ## 📝 완전한 사용 예제
412
+
413
+ ### React + Vite 프로젝트
414
+
415
+ ```tsx
416
+ // src/App.tsx
417
+ import { Header } from '@nextlevel_korea/design-system';
418
+ import '@nextlevel_korea/design-system/styles';
419
+
420
+ function App() {
421
+ return (
422
+ <div className="min-h-screen bg-gray-50">
423
+ <Header
424
+ logo="https://via.placeholder.com/150x50/2563eb/ffffff?text=LOGO"
425
+ title="My Awesome App"
426
+ />
427
+ <main className="container mx-auto px-4 py-8">
428
+ <h1 className="text-3xl font-bold text-gray-900">Welcome to My App</h1>
429
+ </main>
430
+ </div>
431
+ );
432
+ }
433
+
434
+ export default App;
435
+ ```
436
+
437
+ ### Next.js 프로젝트
438
+
439
+ ```tsx
440
+ // app/layout.tsx
441
+ import '@nextlevel_korea/design-system/styles';
442
+
443
+ export default function RootLayout({
444
+ children,
445
+ }: {
446
+ children: React.ReactNode;
447
+ }) {
448
+ return (
449
+ <html lang="en">
450
+ <body>{children}</body>
451
+ </html>
452
+ );
453
+ }
454
+ ```
455
+
456
+ ```tsx
457
+ // app/page.tsx
458
+ import { Header } from '@nextlevel_korea/design-system';
459
+
460
+ export default function Home() {
461
+ return (
462
+ <div>
463
+ <Header logo="/logo.png" title="Next.js App" />
464
+ <main>
465
+ <h1>Welcome to Next.js!</h1>
466
+ </main>
467
+ </div>
468
+ );
469
+ }
470
+ ```
471
+
472
+ ### Create React App
473
+
474
+ ```tsx
475
+ // src/App.js
476
+ import { Header } from '@nextlevel_korea/design-system';
477
+ import '@nextlevel_korea/design-system/styles';
478
+
479
+ function App() {
480
+ return (
481
+ <div className="App">
482
+ <Header logo="https://example.com/logo.png" title="React App" />
483
+ <header className="App-header">
484
+ <p>Edit src/App.js and save to reload.</p>
485
+ </header>
486
+ </div>
487
+ );
488
+ }
489
+
490
+ export default App;
491
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextlevel_korea/design-system",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "description": "A modern React design system built with TypeScript and Tailwind CSS - The NextLevel Design System",
6
6
  "keywords": [
File without changes