@akanjs/cli 0.0.145 → 0.0.146
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/cjs/index.js +25 -19
- package/cjs/src/guidelines/componentRule/componentRule.instruction.md +3 -81
- package/cjs/src/guidelines/cssRule/cssRule.instruction.md +435 -0
- package/cjs/src/guidelines/docPageRule/docPageRule.instruction.md +382 -0
- package/cjs/src/guidelines/modelStore/modelStore.instruction.md +2 -1
- package/esm/index.js +25 -19
- package/esm/src/guidelines/componentRule/componentRule.instruction.md +3 -81
- package/esm/src/guidelines/cssRule/cssRule.instruction.md +435 -0
- package/esm/src/guidelines/docPageRule/docPageRule.instruction.md +382 -0
- package/esm/src/guidelines/modelStore/modelStore.instruction.md +2 -1
- package/package.json +1 -1
- package/src/guideline/guideline.command.d.ts +1 -1
- package/src/guideline/guideline.runner.d.ts +1 -1
- package/src/guideline/guideline.script.d.ts +1 -1
- package/src/guidelines/componentRule/componentRule.instruction.md +3 -81
- package/src/guidelines/cssRule/cssRule.instruction.md +435 -0
- package/src/guidelines/docPageRule/docPageRule.instruction.md +382 -0
- package/src/guidelines/modelStore/modelStore.instruction.md +2 -1
package/cjs/index.js
CHANGED
|
@@ -5562,26 +5562,32 @@ ${guideJson.update.rules.map((rule) => `- ${rule}`).join("\n")}
|
|
|
5562
5562
|
const instruction = await Prompter.getInstruction(this.name);
|
|
5563
5563
|
const pageContent = this.workspace.getLocalFile(writePath);
|
|
5564
5564
|
const request = `
|
|
5565
|
-
|
|
5565
|
+
I'm creating a documentation website for the Akan.js framework.
|
|
5566
5566
|
|
|
5567
|
-
1. Akan.js
|
|
5567
|
+
1. Overview of the Akan.js framework
|
|
5568
5568
|
${await this.getDocumentation("framework")}
|
|
5569
5569
|
|
|
5570
|
-
|
|
5571
|
-
|
|
5570
|
+
2. Documentation page writing method
|
|
5571
|
+
${await this.getDocumentation("docPageRule")}
|
|
5572
|
+
|
|
5573
|
+
3. CSS rule with TailwindCSS and DaisyUI
|
|
5574
|
+
${await this.getDocumentation("cssRule")}
|
|
5575
|
+
|
|
5576
|
+
I want to update the Next.js server-side page located at ${writePath}.
|
|
5577
|
+
Below is the content of the currently written page.
|
|
5572
5578
|
\`\`\`tsx
|
|
5573
5579
|
// File: ${writePath}
|
|
5574
5580
|
${pageContent.content}
|
|
5575
5581
|
\`\`\`
|
|
5576
5582
|
|
|
5577
|
-
|
|
5583
|
+
Please update this page with the latest content below. A great design application is needed.
|
|
5578
5584
|
${instruction}
|
|
5579
5585
|
|
|
5580
|
-
CSS
|
|
5581
|
-
- tailwindcss
|
|
5582
|
-
-
|
|
5586
|
+
Please follow these CSS rules when writing:
|
|
5587
|
+
- Use tailwindcss
|
|
5588
|
+
- Use className from the daisyui library
|
|
5583
5589
|
|
|
5584
|
-
|
|
5590
|
+
Please return only the file result in the following format for easy parsing.
|
|
5585
5591
|
\`\`\`tsx
|
|
5586
5592
|
// File: ${writePath}
|
|
5587
5593
|
...pageContent
|
|
@@ -5600,14 +5606,14 @@ var GuidelineRunner = class {
|
|
|
5600
5606
|
const guidelineContent = await session.editMarkdown(request);
|
|
5601
5607
|
workspace.writeFile(writePath, guidelineContent);
|
|
5602
5608
|
}
|
|
5603
|
-
async
|
|
5609
|
+
async deployDocPage(workspace, guideName) {
|
|
5604
5610
|
const session = new AiSession("deployDocPages", { workspace, cacheKey: guideName });
|
|
5605
5611
|
const guideJson = await Prompter.getGuideJson(guideName);
|
|
5606
5612
|
const prompt = new GuidelinePrompt(workspace, guideName);
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5613
|
+
if (!guideJson.page)
|
|
5614
|
+
return Promise.resolve({});
|
|
5615
|
+
const { request } = await prompt.requestUpdateDocumentPage(guideJson.page);
|
|
5616
|
+
await session.writeTypescripts(request, workspace);
|
|
5611
5617
|
}
|
|
5612
5618
|
};
|
|
5613
5619
|
|
|
@@ -5618,9 +5624,9 @@ var GuidelineScript = class {
|
|
|
5618
5624
|
const guideName = name ?? await Prompter.selectGuideline();
|
|
5619
5625
|
await this.#runner.generateInstruction(workspace, guideName);
|
|
5620
5626
|
}
|
|
5621
|
-
async
|
|
5627
|
+
async deployDocPage(workspace, name = null) {
|
|
5622
5628
|
const guideName = name ?? await Prompter.selectGuideline();
|
|
5623
|
-
await this.#runner.
|
|
5629
|
+
await this.#runner.deployDocPage(workspace, guideName);
|
|
5624
5630
|
}
|
|
5625
5631
|
};
|
|
5626
5632
|
|
|
@@ -5630,8 +5636,8 @@ var GuidelineCommand = class {
|
|
|
5630
5636
|
async generateInstruction(name, workspace) {
|
|
5631
5637
|
await this.guidelineScript.generateInstruction(workspace, name);
|
|
5632
5638
|
}
|
|
5633
|
-
async
|
|
5634
|
-
await this.guidelineScript.
|
|
5639
|
+
async deployDoc(name, workspace) {
|
|
5640
|
+
await this.guidelineScript.deployDocPage(workspace, name);
|
|
5635
5641
|
}
|
|
5636
5642
|
};
|
|
5637
5643
|
__decorateClass([
|
|
@@ -5643,7 +5649,7 @@ __decorateClass([
|
|
|
5643
5649
|
Target.Public(),
|
|
5644
5650
|
__decorateParam(0, Argument("name", { ask: "name of the instruction", nullable: true })),
|
|
5645
5651
|
__decorateParam(1, Workspace())
|
|
5646
|
-
], GuidelineCommand.prototype, "
|
|
5652
|
+
], GuidelineCommand.prototype, "deployDoc", 1);
|
|
5647
5653
|
GuidelineCommand = __decorateClass([
|
|
5648
5654
|
Commands()
|
|
5649
5655
|
], GuidelineCommand);
|
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
1. [Component Architecture](#component-architecture)
|
|
6
6
|
2. [Component Types](#component-types)
|
|
7
7
|
3. [File Naming Conventions](#file-naming-conventions)
|
|
8
|
-
4. [
|
|
9
|
-
5. [
|
|
10
|
-
6. [
|
|
11
|
-
7. [Complete Examples](#complete-examples)
|
|
8
|
+
4. [Utility Functions](#utility-functions)
|
|
9
|
+
5. [Best Practices](#best-practices)
|
|
10
|
+
6. [Complete Examples](#complete-examples)
|
|
12
11
|
|
|
13
12
|
---
|
|
14
13
|
|
|
@@ -248,83 +247,6 @@ Akan.js uses a strict naming convention to maintain consistency:
|
|
|
248
247
|
|
|
249
248
|
---
|
|
250
249
|
|
|
251
|
-
## CSS Rule with TailwindCSS and DaisyUI
|
|
252
|
-
|
|
253
|
-
Akan.js uses TailwindCSS with DaisyUI for styling. Follow these guidelines:
|
|
254
|
-
|
|
255
|
-
### 1. Class Management
|
|
256
|
-
|
|
257
|
-
Always use `clsx` for conditional and composite classes:
|
|
258
|
-
|
|
259
|
-
```tsx
|
|
260
|
-
import { clsx } from "@akanjs/client";
|
|
261
|
-
|
|
262
|
-
className={clsx(
|
|
263
|
-
"base-classes",
|
|
264
|
-
condition && "conditional-class",
|
|
265
|
-
variant === "primary" ? "primary-class" : "secondary-class",
|
|
266
|
-
className // Always include passed className for composition
|
|
267
|
-
)}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### 2. Color System
|
|
271
|
-
|
|
272
|
-
Use DaisyUI's theme colors instead of hardcoded values. This ensures theme consistency and dark/light mode compatibility:
|
|
273
|
-
|
|
274
|
-
```tsx
|
|
275
|
-
// Good - uses theme colors
|
|
276
|
-
className = "bg-primary text-base-100";
|
|
277
|
-
|
|
278
|
-
// Bad - uses hardcoded colors
|
|
279
|
-
className = "bg-[#C33C32] text-[#FFFFFF]";
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
DaisyUI provides semantic colors:
|
|
283
|
-
|
|
284
|
-
- `primary`, `secondary`, `accent` - Brand colors
|
|
285
|
-
- `base-100` through `base-900` - Background/text variants
|
|
286
|
-
- `info`, `success`, `warning`, `error` - Status colors
|
|
287
|
-
|
|
288
|
-
### 3. Responsive Design
|
|
289
|
-
|
|
290
|
-
Use Tailwind's responsive prefixes:
|
|
291
|
-
|
|
292
|
-
```tsx
|
|
293
|
-
<div className="flex-col md:flex-row">
|
|
294
|
-
<div className="w-full md:w-1/2 lg:w-1/3">Responsive width</div>
|
|
295
|
-
<div className="hidden lg:block">Only visible on large screens</div>
|
|
296
|
-
</div>
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### 4. Animation
|
|
300
|
-
|
|
301
|
-
Use Tailwind animation classes with transitions:
|
|
302
|
-
|
|
303
|
-
```tsx
|
|
304
|
-
<div className="transition-all duration-300 hover:scale-105">
|
|
305
|
-
Hover effect
|
|
306
|
-
</div>
|
|
307
|
-
|
|
308
|
-
<div className="animate-pulse">Loading indicator</div>
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### 5. Component Styling
|
|
312
|
-
|
|
313
|
-
Use DaisyUI components for consistent UIs:
|
|
314
|
-
|
|
315
|
-
```tsx
|
|
316
|
-
<button className="btn btn-primary btn-sm">Primary Button</button>
|
|
317
|
-
|
|
318
|
-
<div className="card bg-base-200 shadow-md">
|
|
319
|
-
<div className="card-body">
|
|
320
|
-
<h2 className="card-title">Card Title</h2>
|
|
321
|
-
<p>Card content</p>
|
|
322
|
-
</div>
|
|
323
|
-
</div>
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
250
|
## Utility Functions
|
|
329
251
|
|
|
330
252
|
Akan.js provides several utility modules for common frontend tasks:
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
# CSS Styling Guidelines with TailwindCSS and DaisyUI in Akan.js
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
This document provides comprehensive styling guidelines for Akan.js components using TailwindCSS and DaisyUI. Following these standards ensures consistency, maintainability, and proper theming across all applications in the Akan.js ecosystem.
|
|
6
|
+
|
|
7
|
+
## Core Principles
|
|
8
|
+
|
|
9
|
+
1. **Utility-First Approach**: Use Tailwind's utility classes for styling instead of custom CSS
|
|
10
|
+
2. **Component Composition**: Design with composition in mind, allowing styling overrides via `className` prop
|
|
11
|
+
3. **Theme Consistency**: Use DaisyUI's theme variables for colors and maintain consistent spacing
|
|
12
|
+
4. **Responsive Design**: Implement mobile-first responsive layouts using Tailwind's breakpoint prefixes
|
|
13
|
+
5. **Accessibility**: Ensure proper contrast, focus states, and semantic markup
|
|
14
|
+
|
|
15
|
+
## Class Management with `clsx`
|
|
16
|
+
|
|
17
|
+
### Importing `clsx`
|
|
18
|
+
|
|
19
|
+
Always import the `clsx` utility from the client package:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { clsx } from "@akanjs/client";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Basic Usage
|
|
26
|
+
|
|
27
|
+
Use `clsx` to combine class names conditionally:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<div
|
|
31
|
+
className={clsx(
|
|
32
|
+
"base-classes", // Always applied
|
|
33
|
+
condition && "conditional-classes", // Applied when condition is true
|
|
34
|
+
className // Forward className from props
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
{/* Content */}
|
|
38
|
+
</div>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Object Syntax for Multiple Conditions
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<div
|
|
45
|
+
className={clsx(
|
|
46
|
+
"base-styles",
|
|
47
|
+
{
|
|
48
|
+
"bg-primary": isPrimary,
|
|
49
|
+
"bg-secondary": isSecondary,
|
|
50
|
+
"bg-success": isSuccess,
|
|
51
|
+
"bg-error": isError,
|
|
52
|
+
},
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
>
|
|
56
|
+
{/* Content */}
|
|
57
|
+
</div>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Component Structure Best Practices
|
|
61
|
+
|
|
62
|
+
### 1. Accept and Forward `className` Prop
|
|
63
|
+
|
|
64
|
+
Every component should accept a `className` prop to enable style composition:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
interface CardProps {
|
|
68
|
+
className?: string;
|
|
69
|
+
// Other props...
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const Card = ({ className, ...props }: CardProps) => {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
className={clsx(
|
|
76
|
+
"card bg-base-100 shadow-md",
|
|
77
|
+
className // Always include at the end to allow overrides
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
{/* Card content */}
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. Use DaisyUI's Semantic Color System
|
|
87
|
+
|
|
88
|
+
Avoid hardcoded color values. Use DaisyUI's theme variables instead for better theming support:
|
|
89
|
+
|
|
90
|
+
✅ **Recommended:**
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
<div className="bg-primary text-primary-content hover:bg-primary-focus">Themeable content</div>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
❌ **Avoid:**
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<div className="bg-[#3b82f6] text-white hover:bg-[#2563eb]">Hardcoded colors</div>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**DaisyUI Color System:**
|
|
103
|
+
|
|
104
|
+
| Base Color | Text Color | Focus/Hover Variant |
|
|
105
|
+
| ---------- | ----------------- | ------------------- |
|
|
106
|
+
| primary | primary-content | primary-focus |
|
|
107
|
+
| secondary | secondary-content | secondary-focus |
|
|
108
|
+
| accent | accent-content | accent-focus |
|
|
109
|
+
| neutral | neutral-content | neutral-focus |
|
|
110
|
+
| base-100 | base-content | base-200/base-300 |
|
|
111
|
+
| info | info-content | info-focus |
|
|
112
|
+
| success | success-content | success-focus |
|
|
113
|
+
| warning | warning-content | warning-focus |
|
|
114
|
+
| error | error-content | error-focus |
|
|
115
|
+
|
|
116
|
+
### 3. Implement Responsive Design
|
|
117
|
+
|
|
118
|
+
Use Tailwind's responsive prefixes for mobile-first development:
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<div className="flex flex-col gap-4 md:flex-row">
|
|
122
|
+
<div className="w-full md:w-1/3">Sidebar</div>
|
|
123
|
+
<div className="w-full md:w-2/3">Main Content</div>
|
|
124
|
+
</div>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Breakpoint prefixes:**
|
|
128
|
+
|
|
129
|
+
- `sm:` - 640px and above
|
|
130
|
+
- `md:` - 768px and above
|
|
131
|
+
- `lg:` - 1024px and above
|
|
132
|
+
- `xl:` - 1280px and above
|
|
133
|
+
- `2xl:` - 1536px and above
|
|
134
|
+
|
|
135
|
+
### 4. Implement State and Interaction Variants
|
|
136
|
+
|
|
137
|
+
Use Tailwind's state variants for interactive elements:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
<button className="bg-primary text-primary-content hover:bg-primary-focus focus:ring-primary focus:ring-2 focus:ring-offset-2 active:scale-95 disabled:pointer-events-none disabled:opacity-50">
|
|
141
|
+
Interactive Button
|
|
142
|
+
</button>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Common state variants:**
|
|
146
|
+
|
|
147
|
+
- `hover:` - Mouse hover state
|
|
148
|
+
- `focus:` - Focus state
|
|
149
|
+
- `active:` - Active/pressed state
|
|
150
|
+
- `disabled:` - Disabled state
|
|
151
|
+
- `group-hover:` - Parent hover targeting child elements
|
|
152
|
+
- `dark:` - Dark mode variant
|
|
153
|
+
|
|
154
|
+
### 5. Use Consistent Spacing
|
|
155
|
+
|
|
156
|
+
Maintain consistent spacing using Tailwind's scale:
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
<div className="space-y-4">
|
|
160
|
+
<div className="p-4">Section 1</div>
|
|
161
|
+
<div className="p-4">Section 2</div>
|
|
162
|
+
<div className="p-4">Section 3</div>
|
|
163
|
+
</div>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Component Types in Akan.js
|
|
167
|
+
|
|
168
|
+
Akan.js follows specific component naming conventions with distinct styling approaches:
|
|
169
|
+
|
|
170
|
+
### 1. Unit Components (\*.Unit.tsx)
|
|
171
|
+
|
|
172
|
+
List items or cards that display summarized data:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
// Example: Project.Unit.tsx
|
|
176
|
+
export const Card = ({ className, project, href }: ModelProps<"project", cnst.LightProject>) => {
|
|
177
|
+
return (
|
|
178
|
+
<Link
|
|
179
|
+
href={href}
|
|
180
|
+
className={clsx(
|
|
181
|
+
"border-base-300 bg-base-100 flex flex-col gap-3 rounded-lg border-2 p-4",
|
|
182
|
+
"hover:border-primary transition-all hover:shadow-md",
|
|
183
|
+
"focus:ring-primary focus:outline-hidden focus:ring-2",
|
|
184
|
+
className
|
|
185
|
+
)}
|
|
186
|
+
>
|
|
187
|
+
<h3 className="text-base-content text-lg font-semibold">{project.name}</h3>
|
|
188
|
+
{/* Additional content */}
|
|
189
|
+
</Link>
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 2. View Components (\*.View.tsx)
|
|
195
|
+
|
|
196
|
+
Detailed displays of full data models:
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
// Example: Project.View.tsx
|
|
200
|
+
export const Detail = ({ className, project }: ModelProps<"project", cnst.FullProject>) => {
|
|
201
|
+
return (
|
|
202
|
+
<div className={clsx("bg-base-100 rounded-lg p-6 shadow-lg", className)}>
|
|
203
|
+
<div className="border-primary mb-6 border-l-4 pl-4">
|
|
204
|
+
<h1 className="text-primary text-2xl font-bold">{project.name}</h1>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">{/* Project details */}</div>
|
|
208
|
+
</div>
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 3. Edit Components (\*.Edit.tsx)
|
|
214
|
+
|
|
215
|
+
Form components for creating or editing data:
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
// Example: Project.Edit.tsx
|
|
219
|
+
export const Form = ({ className }: { className?: string }) => {
|
|
220
|
+
const { project, setProject } = useProjectStore();
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<div className={clsx("card bg-base-100 p-6 shadow-lg", className)}>
|
|
224
|
+
<h2 className="card-title mb-4">Project Details</h2>
|
|
225
|
+
|
|
226
|
+
<div className="form-control w-full">
|
|
227
|
+
<label className="label">
|
|
228
|
+
<span className="label-text">Project Name</span>
|
|
229
|
+
</label>
|
|
230
|
+
<input
|
|
231
|
+
type="text"
|
|
232
|
+
className="input input-bordered w-full"
|
|
233
|
+
value={project.name}
|
|
234
|
+
onChange={(e) => setProject({ ...project, name: e.target.value })}
|
|
235
|
+
/>
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
{/* Additional form fields */}
|
|
239
|
+
</div>
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### 4. Util Components (\*.Util.tsx)
|
|
245
|
+
|
|
246
|
+
Special function components like buttons, toggles, and actions:
|
|
247
|
+
|
|
248
|
+
```tsx
|
|
249
|
+
// Example: Project.Util.tsx
|
|
250
|
+
export const StatusBadge = ({ className, status }: { className?: string; status: ProjectStatus }) => {
|
|
251
|
+
return (
|
|
252
|
+
<span
|
|
253
|
+
className={clsx(
|
|
254
|
+
"badge font-medium",
|
|
255
|
+
status === "active" && "badge-success",
|
|
256
|
+
status === "pending" && "badge-warning",
|
|
257
|
+
status === "canceled" && "badge-error",
|
|
258
|
+
status === "completed" && "badge-info",
|
|
259
|
+
className
|
|
260
|
+
)}
|
|
261
|
+
>
|
|
262
|
+
{status}
|
|
263
|
+
</span>
|
|
264
|
+
);
|
|
265
|
+
};
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### 5. Zone Components (\*.Zone.tsx)
|
|
269
|
+
|
|
270
|
+
Container components that combine multiple components:
|
|
271
|
+
|
|
272
|
+
```tsx
|
|
273
|
+
// Example: Project.Zone.tsx
|
|
274
|
+
export const ProjectDashboard = ({ className }: { className?: string }) => {
|
|
275
|
+
return (
|
|
276
|
+
<div className={clsx("grid grid-cols-1 gap-6 lg:grid-cols-3", className)}>
|
|
277
|
+
<div className="lg:col-span-2">
|
|
278
|
+
<ProjectSummary />
|
|
279
|
+
</div>
|
|
280
|
+
<div>
|
|
281
|
+
<ProjectStats />
|
|
282
|
+
</div>
|
|
283
|
+
<div className="lg:col-span-3">
|
|
284
|
+
<ProjectTimeline />
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
);
|
|
288
|
+
};
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Common UI Patterns
|
|
292
|
+
|
|
293
|
+
### 1. Card Pattern
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
<div className="card bg-base-100 shadow-md transition-shadow hover:shadow-lg">
|
|
297
|
+
<figure className="px-4 pt-4">
|
|
298
|
+
<img src={image.url} alt={title} className="h-48 w-full rounded-lg object-cover" />
|
|
299
|
+
</figure>
|
|
300
|
+
<div className="card-body">
|
|
301
|
+
<h2 className="card-title">{title}</h2>
|
|
302
|
+
<p className="text-base-content/70">{description}</p>
|
|
303
|
+
<div className="card-actions mt-4 justify-end">
|
|
304
|
+
<button className="btn btn-primary btn-sm">View Details</button>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### 2. Form Pattern
|
|
311
|
+
|
|
312
|
+
```tsx
|
|
313
|
+
<div className="form-control w-full max-w-md">
|
|
314
|
+
<label className="label">
|
|
315
|
+
<span className="label-text">Email</span>
|
|
316
|
+
</label>
|
|
317
|
+
<input
|
|
318
|
+
type="email"
|
|
319
|
+
className="input input-bordered w-full"
|
|
320
|
+
value={email}
|
|
321
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
322
|
+
/>
|
|
323
|
+
<label className="label">
|
|
324
|
+
<span className="label-text-alt text-error">{error}</span>
|
|
325
|
+
</label>
|
|
326
|
+
</div>
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### 3. List Pattern
|
|
330
|
+
|
|
331
|
+
```tsx
|
|
332
|
+
<div className="bg-base-100 rounded-lg shadow">
|
|
333
|
+
<div className="border-base-200 border-b p-4 font-medium">Items List</div>
|
|
334
|
+
<ul>
|
|
335
|
+
{items.map((item) => (
|
|
336
|
+
<li key={item.id} className="border-base-200 border-b last:border-none">
|
|
337
|
+
<div className="hover:bg-base-200 p-4 transition-colors">
|
|
338
|
+
<div className="flex items-center justify-between">
|
|
339
|
+
<span>{item.name}</span>
|
|
340
|
+
<span className="badge badge-outline">{item.category}</span>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</li>
|
|
344
|
+
))}
|
|
345
|
+
</ul>
|
|
346
|
+
</div>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### 4. Dashboard Pattern
|
|
350
|
+
|
|
351
|
+
```tsx
|
|
352
|
+
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4">
|
|
353
|
+
<div className="stats bg-base-100 shadow">
|
|
354
|
+
<div className="stat">
|
|
355
|
+
<div className="stat-title">Total Users</div>
|
|
356
|
+
<div className="stat-value">{totalUsers}</div>
|
|
357
|
+
<div className="stat-desc">↗︎ 14% from last month</div>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
{/* Additional stat cards */}
|
|
362
|
+
</div>
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Best Practices
|
|
366
|
+
|
|
367
|
+
### 1. Component Composition
|
|
368
|
+
|
|
369
|
+
- Create small, focused components
|
|
370
|
+
- Combine them to build complex UIs
|
|
371
|
+
- Use props for variations
|
|
372
|
+
- Accept and forward `className` for style overrides
|
|
373
|
+
|
|
374
|
+
### 2. Consistent Layout
|
|
375
|
+
|
|
376
|
+
- Use Flexbox and Grid for layouts
|
|
377
|
+
- Maintain consistent spacing
|
|
378
|
+
- Implement proper padding and margins
|
|
379
|
+
- Design for all screen sizes
|
|
380
|
+
|
|
381
|
+
### 3. Color Usage
|
|
382
|
+
|
|
383
|
+
- Use DaisyUI theme colors
|
|
384
|
+
- Maintain proper contrast ratios
|
|
385
|
+
- Use opacity modifiers for variants (`bg-primary/80`)
|
|
386
|
+
- Avoid hardcoded colors
|
|
387
|
+
|
|
388
|
+
### 4. Performance Optimization
|
|
389
|
+
|
|
390
|
+
- Group related classes
|
|
391
|
+
- Use Tailwind's JIT mode
|
|
392
|
+
- Purge unused styles in production
|
|
393
|
+
- Prefer Tailwind classes over custom CSS
|
|
394
|
+
|
|
395
|
+
### 5. Dark Mode Support
|
|
396
|
+
|
|
397
|
+
```tsx
|
|
398
|
+
<div className="bg-base-100 text-base-content">{/* Content automatically adapts to dark mode via DaisyUI */}</div>
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
## Common Mistakes to Avoid
|
|
402
|
+
|
|
403
|
+
1. **Inconsistent Spacing**: Mixing arbitrary values instead of using Tailwind's scale
|
|
404
|
+
2. **Hardcoded Colors**: Using hex codes or RGB values instead of theme variables
|
|
405
|
+
3. **Missing `className` Prop**: Not forwarding the prop for composition
|
|
406
|
+
4. **Direct Style Imports**: Importing component styles directly instead of using utility classes
|
|
407
|
+
5. **Overriding Base Styles**: Applying too many custom styles that break theme consistency
|
|
408
|
+
|
|
409
|
+
## Troubleshooting
|
|
410
|
+
|
|
411
|
+
### 1. Styles Not Applying
|
|
412
|
+
|
|
413
|
+
- Check for typos in class names
|
|
414
|
+
- Ensure proper precedence (later classes override earlier ones)
|
|
415
|
+
- Verify the correct Tailwind configuration
|
|
416
|
+
|
|
417
|
+
### 2. DaisyUI Components Not Working
|
|
418
|
+
|
|
419
|
+
- Check DaisyUI installation
|
|
420
|
+
- Verify theme configuration
|
|
421
|
+
- Ensure component classes are applied correctly
|
|
422
|
+
|
|
423
|
+
### 3. Responsive Design Issues
|
|
424
|
+
|
|
425
|
+
- Test at various breakpoints
|
|
426
|
+
- Use the correct breakpoint prefixes
|
|
427
|
+
- Implement mobile-first approach
|
|
428
|
+
|
|
429
|
+
## Additional Resources
|
|
430
|
+
|
|
431
|
+
1. [TailwindCSS Documentation](https://tailwindcss.com/docs)
|
|
432
|
+
2. [DaisyUI Documentation](https://daisyui.com/)
|
|
433
|
+
3. [Tailwind CSS Cheat Sheet](https://nerdcave.com/tailwind-cheat-sheet)
|
|
434
|
+
|
|
435
|
+
By following these guidelines, you'll create consistent, maintainable, and themeable components that align with the Akan.js design system. Always prioritize composition over customization and leverage the power of TailwindCSS and DaisyUI utilities.
|