Skip to content

Commit a4fcafb

Browse files
committed
add styling guide
1 parent ab356ed commit a4fcafb

6 files changed

Lines changed: 108 additions & 4 deletions

File tree

packages/b2c-dx-mcp/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ The `storefront_next_development_guidelines` tool provides critical architecture
105105
- `state-management` - Client-side state management
106106
- `auth` - Authentication and session management
107107
- `components` - Component patterns and best practices
108+
- `styling` - Tailwind CSS 4, Shadcn/ui, styling guidelines
108109
- `page-designer` - Page Designer integration
109110
- `performance` - Performance optimization
110111
- `testing` - Testing strategies

packages/b2c-dx-mcp/content/components.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,23 @@ src/components/product-skeleton/
101101
└── index.stories.tsx
102102
```
103103

104+
## Styling
105+
106+
**Tailwind CSS 4** is the only styling approach allowed. Use utility classes directly in components.
107+
108+
**Key rules:**
109+
110+
- ✅ Use Tailwind utility classes
111+
- ✅ Use `cn()` utility for conditional classes
112+
- ❌ NO inline styles, NO CSS modules, NO separate CSS files
113+
114+
**See `styling` section for:** Tailwind CSS 4, Shadcn/ui components, icons, responsive design, theme configuration, dark mode, best practices
115+
104116
## Best Practices
105117

106118
1. **Extract view components** - Separate data handling from presentation
107119
2. **Type safety** - Define proper TypeScript interfaces
108120
3. **Consistent fallbacks** - Reusable skeleton components
109121
4. **Colocate tests** - Keep tests next to components
110122
5. **Story coverage** - Create stories for all reusable components
123+
6. **Tailwind utilities only** - Use Tailwind CSS classes, avoid inline styles or CSS modules

packages/b2c-dx-mcp/content/quick-reference.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,28 @@ const ProductPage = createPage({
7373
export default ProductPage;
7474
```
7575

76+
### 5. Tailwind CSS 4 Only
77+
78+
**REQUIRED**: Use Tailwind utility classes only
79+
**BLOCKED**: No inline styles (`style={{...}}`), no CSS modules, no separate CSS files
80+
81+
```typescript
82+
// ✅ CORRECT - Tailwind utilities
83+
<div className="rounded-lg border border-border bg-card p-4">
84+
<h2 className="text-lg font-semibold text-card-foreground">
85+
{product.name}
86+
</h2>
87+
</div>
88+
89+
// ❌ AVOID - Inline styles
90+
<div style={{ padding: '1rem' }}>
91+
92+
// ❌ AVOID - CSS modules
93+
import styles from './product-card.module.css';
94+
```
95+
96+
**Why?** Consistent styling approach, better performance, automatic dark mode support via theme variables.
97+
7698
---
7799

78100
## 📋 Quick Patterns
@@ -140,9 +162,6 @@ const { t } = getTranslation(context);
140162
### Components
141163

142164
```typescript
143-
// shadcn/ui: Add via npx shadcn@latest add <component-name>
144-
// DO NOT modify src/components/ui/ directly
145-
146165
// Suspense boundaries
147166
import { Suspense } from 'react';
148167
import { Await } from 'react-router';
@@ -156,6 +175,23 @@ import { Await } from 'react-router';
156175

157176
**See `components` section for:** createPage HOC, file organization, best practices
158177

178+
### Styling
179+
180+
```typescript
181+
// Tailwind utility classes
182+
<div className="bg-background text-foreground border-border">
183+
<button className="bg-primary text-primary-foreground rounded-md px-4 py-2">
184+
Click me
185+
</button>
186+
</div>
187+
188+
// shadcn/ui: Add via npx shadcn@latest add <component-name>
189+
import { Button } from '@/components/ui/button';
190+
import { Card } from '@/components/ui/card';
191+
```
192+
193+
**See `styling` section for:** Tailwind CSS 4 rules, Shadcn/ui components, dark mode, responsive design
194+
159195
---
160196

161197
## 🔍 Get Detailed Guidelines
@@ -171,6 +207,7 @@ Use the `storefront_next_development_guidelines` MCP tool with specific sections
171207
**Available sections:**
172208
- `data-fetching` - Loaders, actions, useScapiFetcher, data flow
173209
- `components` - createPage HOC, Suspense, file organization
210+
- `styling` - Tailwind CSS 4, Shadcn/ui, styling guidelines
174211
- `testing` - Vitest, Storybook, coverage requirements
175212
- `auth` - Authentication and session management
176213
- `config` - Configuration system
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Styling Guidelines
2+
3+
## Rules
4+
5+
-**Use Tailwind utility classes** in component JSX
6+
-**Use `cn()` utility** for conditional classes (`import { cn } from '@/lib/utils'`)
7+
-**Follow mobile-first** responsive patterns (`md:`, `lg:` breakpoints)
8+
-**NO inline styles** (`style={{...}}`)
9+
-**NO CSS modules** (`.module.css` files)
10+
-**NO separate CSS files** for component styles
11+
-**Custom CSS** only in `src/app.css` for global styles and theme configuration
12+
13+
## Shadcn/ui Components
14+
15+
**Adding components:**
16+
17+
```bash
18+
npx shadcn@latest add <component-name>
19+
```
20+
21+
**Rules:**
22+
23+
-**DO** customize components by editing files in `src/components/ui/`
24+
-**DON'T** create custom components inside `src/components/ui/`
25+
-**DON'T** manually copy components (use CLI instead)
26+
27+
## Dark Mode
28+
29+
Dark mode is supported via CSS variables and the `.dark` class. Theme variables automatically adapt:
30+
31+
```typescript
32+
<div className="bg-background text-foreground border-border">
33+
<button className="bg-primary text-primary-foreground">
34+
Click me
35+
</button>
36+
</div>
37+
```
38+
39+
## Responsive Design
40+
41+
Follow mobile-first responsive design:
42+
43+
```typescript
44+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
45+
{/* Content */}
46+
</div>
47+
```
48+
49+
---
50+
51+
**Reference:** See [README-UI-STYLING.md](README-UI-STYLING.md) for complete UI and styling documentation.

packages/b2c-dx-mcp/src/tools/storefrontnext/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ MCP tools for Storefront Next development with React Server Components.
3333
- `config` - Configuration system
3434
- `i18n` - Internationalization patterns
3535
- `components` - Component best practices
36+
- `styling` - Tailwind CSS 4, Shadcn/ui, styling guidelines
3637
- `page-designer` - Page Designer integration and component registry
3738
- `performance` - Optimization techniques
3839
- `testing` - Testing strategy
@@ -74,7 +75,7 @@ MCP tools for Storefront Next development with React Server Components.
7475
{
7576
"name": "storefront_next_development_guidelines",
7677
"arguments": {
77-
"sections": ["quick-reference", "data-fetching", "state-management", "auth", "config", "i18n", "components", "page-designer", "performance", "testing", "extensions", "pitfalls"]
78+
"sections": ["quick-reference", "data-fetching", "state-management", "auth", "config", "i18n", "components", "styling", "page-designer", "performance", "testing", "extensions", "pitfalls"]
7879
}
7980
}
8081
```

packages/b2c-dx-mcp/src/tools/storefrontnext/developer-guidelines.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const SECTIONS_METADATA = [
4444
{key: 'config', description: 'configuration'},
4545
{key: 'i18n', description: 'i18n patterns and internationalization'},
4646
{key: 'components', description: 'component best practices'},
47+
{key: 'styling', description: 'Tailwind CSS 4, Shadcn/ui, styling guidelines'},
4748
{key: 'page-designer', description: 'Page Designer integration'},
4849
{key: 'performance', description: 'performance optimization'},
4950
{key: 'testing', description: 'testing strategies'},

0 commit comments

Comments
 (0)