Skip to content

Commit c64b95d

Browse files
PJCoopsclaude
andcommitted
docs: Update project template with Vite, themes, and accessibility
- Add Vite setup instructions alongside Next.js - Add PixelGrid for branded loading animations - Add Visual Themes section (base vs elevated) - Add Accessibility Features section with all modes - Update troubleshooting for elevated theme Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8bdf704 commit c64b95d

1 file changed

Lines changed: 82 additions & 5 deletions

File tree

CLAUDE.project-template.md

Lines changed: 82 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ This project uses the **Sourceful Design System**. All UI components must come f
66

77
### Critical Setup Requirements
88

9+
#### Next.js Setup
10+
911
```tsx
10-
// 1. In your root layout (app/layout.tsx or pages/_app.tsx)
12+
// 1. In your root layout (app/layout.tsx)
1113
// CSS IMPORT ORDER MATTERS - design system MUST be first
1214
import "@sourceful-energy/ui/styles.css" // FIRST - contains CSS variables
1315
import "./globals.css" // SECOND - project overrides
@@ -31,6 +33,24 @@ export default function RootLayout({ children }) {
3133
}
3234
```
3335

36+
#### Vite Setup
37+
38+
```tsx
39+
// main.tsx - CSS IMPORT ORDER MATTERS
40+
import "@sourceful-energy/ui/styles.css" // FIRST
41+
import "./index.css" // SECOND
42+
43+
import { DesignSystemProvider } from "@sourceful-energy/ui"
44+
45+
function App() {
46+
return (
47+
<DesignSystemProvider defaultTheme="system">
48+
{/* Your app */}
49+
</DesignSystemProvider>
50+
)
51+
}
52+
```
53+
3454
### Component Quick Reference
3555

3656
| Need | Use |
@@ -43,7 +63,8 @@ export default function RootLayout({ children }) {
4363
| Overlays | `Dialog`, `Sheet`, `DropdownMenu`, `Tooltip` |
4464
| Layout | `Tabs`, `SimpleTabs`, `Accordion`, `Separator`, `ScrollArea`, `Table` |
4565
| Navigation | `SideMenu`, `TopMenu` |
46-
| Brand | `Logo` (variants: full, symbol, wordmark) |
66+
| Brand | `Logo` (variants: full, symbol, wordmark), `PixelGrid` (animated brand element) |
67+
| Loading | `PixelGrid` (branded loading animation), `Skeleton` (content placeholder) |
4768

4869
### Color Token Usage
4970

@@ -78,6 +99,58 @@ toast.error("Failed")
7899
<Label htmlFor="email">Email</Label>
79100
<Input id="email" type="email" />
80101
</div>
102+
103+
// Loading states: Use PixelGrid instead of spinners
104+
import { PixelGrid } from "@sourceful-energy/ui"
105+
106+
// Centered loading
107+
<div className="flex flex-col items-center justify-center py-8">
108+
<PixelGrid pattern="frame" size="md" />
109+
<p className="text-sm text-muted-foreground mt-4">Loading...</p>
110+
</div>
111+
112+
// Compact loading (next to buttons/text)
113+
<div className="flex items-center gap-3">
114+
<PixelGrid dimension={4} pattern="cross-spin" size="sm" />
115+
<span className="text-sm text-muted-foreground">Saving...</span>
116+
</div>
117+
```
118+
119+
### Visual Themes
120+
121+
```tsx
122+
// Base theme (default) - Clean, minimal styling
123+
<html lang="en">
124+
125+
// Elevated theme - Gradient borders on cards, buttons, badges
126+
<html lang="en" data-theme="elevated">
127+
128+
// The elevated theme adds green gradient lighting effects to:
129+
// - Card borders
130+
// - Primary buttons and badges
131+
// - Input focus states
132+
// - Tab indicators
133+
```
134+
135+
### Accessibility Features
136+
137+
```tsx
138+
// Full accessibility support with AccessibilityProvider
139+
import { AccessibilityProvider, AccessibilitySettings } from "@sourceful-energy/ui"
140+
141+
<AccessibilityProvider>
142+
<App />
143+
<AccessibilitySettings /> {/* Optional settings panel */}
144+
</AccessibilityProvider>
145+
146+
// Available accessibility modes (set via data attributes):
147+
// data-font-mode="dyslexic" - Lexend font for dyslexia
148+
// data-color-mode="deuteranopia" | "protanopia" | "tritanopia" | "achromatopsia"
149+
// data-focus-mode="enhanced" - High-visibility focus rings
150+
// data-spacing="comfortable" - Increased text spacing
151+
152+
// Example: Enable dyslexic font mode
153+
<html data-font-mode="dyslexic">
81154
```
82155

83156
### Reskinning Existing Code
@@ -112,11 +185,15 @@ When migrating existing components to the design system:
112185

113186
**Unstyled components / CSS variables undefined:**
114187
- Verify `@sourceful-energy/ui/styles.css` is imported FIRST in your layout
115-
- Check package version is 0.1.22 or later: `npm list @sourceful-energy/ui`
188+
- Check package version is 0.1.30 or later: `npm list @sourceful-energy/ui`
116189

117190
**Dark mode not working:**
118-
- Add `suppressHydrationWarning` to `<html>` tag
119-
- Wrap app in `ThemeProvider` with `attribute="class"`
191+
- Next.js: Add `suppressHydrationWarning` to `<html>` tag, wrap in `ThemeProvider`
192+
- Vite: Use `DesignSystemProvider` which handles theme toggling
193+
194+
**Elevated theme not showing:**
195+
- Add `data-theme="elevated"` to `<html>` element
196+
- Or use `DesignSystemProvider` with `defaultVisualTheme="elevated"`
120197

121198
## Project-Specific Notes
122199

0 commit comments

Comments
 (0)