Skip to content

Commit d5e6c14

Browse files
committed
improve design of cards
1 parent 8e5787d commit d5e6c14

8 files changed

Lines changed: 506 additions & 78 deletions

File tree

.trae/rules/3d-objects.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
alwaysApply: true
3+
---
4+
# 3D Objects — Design & Implementation Rules
5+
6+
## Purpose
7+
Define consistent standards for 3D assets used in dashboard cards and other UI surfaces.
8+
9+
## Directory Structure
10+
- Store authored assets in: `public/3d/`
11+
- Filenames use `snake_case` and map 1:1 with app identifiers.
12+
- Example:
13+
- `public/3d/ai_assistant.glb`
14+
- `public/3d/pyramid_solver.glb`
15+
16+
## Visual Style
17+
- Corners: Prefer high-radius chamfer/rounding on visible primitives (e.g., rounded boxes).
18+
- Materials: Solid, modern materials (Physical/Standard) with tuned metallic/roughness and optional clearcoat.
19+
- Modern Look: Clean silhouettes with mid-poly detail; avoid busy textures. Accents use subtle emissive where appropriate.
20+
21+
## Technical
22+
- Geometry:
23+
- Use rounded primitives where possible (e.g., `RoundedBoxGeometry`).
24+
- Mid-poly is acceptable for better forms; prioritize silhouette and readability in a small viewport.
25+
- Materials:
26+
- Use `MeshPhysicalMaterial` or `MeshStandardMaterial`.
27+
- Suggested baseline: `metalness: 0.2–0.5`, `roughness: 0.25–0.6`, optional `clearcoat: 0–0.3`.
28+
- Accents may use a small `emissive` for modern UI flair.
29+
- Lighting:
30+
- Use `HemisphereLight` plus one or two `DirectionalLight`s for soft, contemporary shading.
31+
- Keep lighting neutral; avoid harsh shadows that obscure silhouettes.
32+
33+
## Integration
34+
- Card viewport is square; models must be centered and uniformly scaled to fit.
35+
- If a model is missing, render a simple procedural shape as a fallback (no UI breakage).
36+
- Procedural presets exist for rapid prototyping: `lowpoly-bot`, `pyramid`, `nodes-graph`, `workshop-tools`, `picture-frame`, `old-book`, `airplane`, `technician`. Replace with authored assets in `public/3d/` as they become available.
37+
38+
## QA Checklist
39+
- Rounded edges are visible at normal zoom.
40+
- No z-fighting or clipping in the square viewport.
41+
- Materials read as solid and modern under default lighting.

components.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"registries": {
2222
"@animate-ui": "https://animate-ui.com/r/{name}.json",
2323
"@ai-elements": "https://ai-sdk.dev/elements/api/registry/{name}.json",
24-
"@shadcn-editor": "https://shadcn-editor.vercel.app/r/{name}.json"
24+
"@shadcn-editor": "https://shadcn-editor.vercel.app/r/{name}.json",
25+
"@cardcn": "https://cardcn.dev/r/{name}.json"
2526
}
2627
}

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"streamdown": "^2.1.0",
9797
"tailwind-merge": "^3.4.0",
9898
"tailwindcss-animate": "^1.0.7",
99+
"three": "^0.182.0",
99100
"tokenlens": "^1.3.1",
100101
"use-stick-to-bottom": "^1.1.2",
101102
"vaul": "^1.1.2",

public/3d/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
3D Models Directory
2+
===================
3+
4+
- Place authored .glb/.gltf models for app cards here.
5+
- Recommended naming (snake_case):
6+
- ai_assistant.glb
7+
- pyramid_solver.glb
8+
- diagram.glb
9+
- product_definitions.glb
10+
- ui_ux_architecture.glb
11+
- documents.glb
12+
- technical_architecture.glb
13+
- technical_tasks.glb
14+
15+
Note: Currently, cards use procedural low-poly presets that follow the 3D Objects rules. When real assets are added here, set modelPath on the card to load them.
16+

src/components/cards/card-2.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
2+
import { cn } from "@/lib/utils";
3+
4+
const Placeholder = {
5+
title: <div className="bg-secondary h-8 max-w-40 w-full rounded-md" />,
6+
content: <div className="bg-secondary h-20 w-full rounded-md" />,
7+
};
8+
9+
const Line = ({ className = "" }) => (
10+
<div
11+
className={cn(
12+
"h-px w-full via-zinc-400 from-1% from-zinc-200 to-zinc-600 absolute z-0 dark:via-zinc-700 dark:from-zinc-900 dark:to-zinc-500",
13+
className,
14+
)}
15+
/>
16+
);
17+
const Lines = () => (
18+
<>
19+
<Line className="bg-linear-to-l left-0 top-2 sm:top-4 md:top-6" />
20+
<Line className="bg-linear-to-r bottom-2 sm:bottom-4 md:bottom-6 left-0" />
21+
22+
<Line className="w-px bg-linear-to-t right-2 sm:right-4 md:right-6 h-full inset-y-0" />
23+
<Line className="w-px bg-linear-to-t left-2 sm:left-4 md:left-6 h-full inset-y-0" />
24+
</>
25+
);
26+
27+
export const Card_2 = () => {
28+
return (
29+
<div className="relative">
30+
<Lines />
31+
<Card className="w-full border-none p-10 shadow-none">
32+
<CardHeader>
33+
<CardTitle>{Placeholder.title}</CardTitle>
34+
</CardHeader>
35+
<CardContent>{Placeholder.content}</CardContent>
36+
</Card>
37+
</div>
38+
);
39+
};

0 commit comments

Comments
 (0)