keystone-design-bootstrap 1.0.13 → 1.0.14
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 +85 -64
- package/package.json +5 -1
- package/src/styles/fonts.css +21 -0
- package/src/styles/theme.css +0 -4
package/README.md
CHANGED
|
@@ -2,13 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive design system for Keystone customer websites. Provides themed sections, elements, and utilities for building consistent, server-rendered Next.js sites.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
1. **Set your theme** in `config/index.ts`:
|
|
8
|
+
```typescript
|
|
9
|
+
export const config = {
|
|
10
|
+
site: { theme: "barelux" } // or "aman", "classic"
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. **Import theme CSS** in your `app/globals.css`:
|
|
15
|
+
```css
|
|
16
|
+
@import "keystone-design-bootstrap/styles/fonts.css";
|
|
17
|
+
@import "keystone-design-bootstrap/styles/theme.css";
|
|
18
|
+
@import "keystone-design-bootstrap/styles/typography.css";
|
|
19
|
+
@import "keystone-design-bootstrap/styles/style-overrides.barelux.css"; /* Change to match your theme */
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
3. **Run** `npm run dev` and you're ready!
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @keystone-pzjr/design-bootstrap
|
|
28
|
+
```
|
|
12
29
|
|
|
13
30
|
## Using the Design System
|
|
14
31
|
|
|
@@ -53,21 +70,6 @@ export default async function HomePage() {
|
|
|
53
70
|
|
|
54
71
|
**Available:** `HeroHome`, `ServicesHome`, `TestimonialsHome`, `BlogSection`, `ContactSection`, `HeaderNavigation`, `FooterHome`, and more.
|
|
55
72
|
|
|
56
|
-
## Architecture
|
|
57
|
-
|
|
58
|
-
- **Server-first**: Data fetching happens server-side, components render as Server Components where possible
|
|
59
|
-
- **Theme variants**: Components automatically select variants based on active theme
|
|
60
|
-
- **Tailwind-first**: Use semantic utility classes (`bg-primary`, `text-fg-primary`, `font-display`)
|
|
61
|
-
- **Type-safe**: Full TypeScript support throughout
|
|
62
|
-
- **CSS variables**: Themes customize via CSS custom properties
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
## Installation
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
npm install @keystone-pzjr/design-bootstrap
|
|
69
|
-
```
|
|
70
|
-
|
|
71
73
|
## Package Exports
|
|
72
74
|
|
|
73
75
|
```typescript
|
|
@@ -93,53 +95,57 @@ import type { Service, Testimonial } from '@keystone-pzjr/design-bootstrap/types
|
|
|
93
95
|
import { themes } from '@keystone-pzjr/design-bootstrap/themes'
|
|
94
96
|
```
|
|
95
97
|
|
|
96
|
-
##
|
|
97
|
-
|
|
98
|
-
Set your theme in `config/index.ts`:
|
|
99
|
-
```typescript
|
|
100
|
-
export const config = {
|
|
101
|
-
site: { theme: "aman" } // or "classic", "barelux"
|
|
102
|
-
}
|
|
103
|
-
```
|
|
98
|
+
## Architecture
|
|
104
99
|
|
|
105
|
-
|
|
100
|
+
- **Server-first**: Data fetching happens server-side, components render as Server Components where possible
|
|
101
|
+
- **Theme variants**: Components automatically select variants based on active theme
|
|
102
|
+
- **Tailwind-first**: Use semantic utility classes (`bg-primary`, `text-fg-primary`, `font-display`)
|
|
103
|
+
- **Type-safe**: Full TypeScript support throughout
|
|
104
|
+
- **CSS variables**: Themes customize via CSS custom properties
|
|
105
|
+
- **Self-hosted fonts**: Uses Fontsource for optimized, bundled font loading
|
|
106
106
|
|
|
107
107
|
## Theme System
|
|
108
108
|
|
|
109
109
|
**Available themes:** `classic`, `aman`, `barelux`
|
|
110
110
|
|
|
111
|
-
Components automatically load theme-specific variants. Set theme in your config and CSS
|
|
111
|
+
Components automatically load theme-specific variants. Set theme in your config and import the corresponding CSS file in `globals.css`.
|
|
112
112
|
|
|
113
113
|
### Creating a New Theme
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
`src/themes/index.ts`:
|
|
115
|
+
#### 1. Register Theme
|
|
116
|
+
Add to `src/themes/index.ts`:
|
|
117
117
|
```typescript
|
|
118
118
|
export const THEME_CONFIG = {
|
|
119
119
|
classic: '',
|
|
120
120
|
aman: '.aman',
|
|
121
|
-
|
|
121
|
+
barelux: '.barelux',
|
|
122
|
+
mytheme: '.mytheme', // Add your theme
|
|
122
123
|
} as const;
|
|
123
124
|
```
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Playfair+Display:wght@400;700&display=swap');
|
|
126
|
+
#### 2. Add Fonts
|
|
127
|
+
Install Fontsource packages in the design bootstrap:
|
|
128
|
+
```bash
|
|
129
|
+
cd keystone-design-bootstrap
|
|
130
|
+
npm install @fontsource/your-body-font @fontsource/your-display-font
|
|
131
|
+
```
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
Add to `src/styles/fonts.css`:
|
|
134
|
+
```css
|
|
135
|
+
/* MyTheme Fonts */
|
|
136
|
+
@import "@fontsource/your-body-font/400.css";
|
|
137
|
+
@import "@fontsource/your-body-font/600.css";
|
|
138
|
+
@import "@fontsource/your-display-font/400.css";
|
|
139
|
+
@import "@fontsource/your-display-font/700.css";
|
|
134
140
|
```
|
|
135
141
|
|
|
136
|
-
|
|
137
|
-
`src/styles/style-overrides.mytheme.css`:
|
|
142
|
+
#### 3. Create CSS Overrides
|
|
143
|
+
Create `src/styles/style-overrides.mytheme.css`:
|
|
138
144
|
```css
|
|
139
145
|
[data-theme="mytheme"] {
|
|
140
146
|
/* Typography */
|
|
141
|
-
--font-body: "
|
|
142
|
-
--font-display: "
|
|
147
|
+
--font-body: "YourBodyFont", sans-serif;
|
|
148
|
+
--font-display: "YourDisplayFont", serif;
|
|
143
149
|
|
|
144
150
|
/* Colors - set both prefixes */
|
|
145
151
|
--color-bg-primary: #FFFFFF;
|
|
@@ -158,38 +164,45 @@ In customer template's `app/globals.css`, add font imports after `@import "tailw
|
|
|
158
164
|
}
|
|
159
165
|
```
|
|
160
166
|
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
#### 4. Use in Customer Site
|
|
168
|
+
In `config/index.ts`:
|
|
163
169
|
```typescript
|
|
164
170
|
export const config: SiteConfig = {
|
|
165
|
-
site: {
|
|
166
|
-
theme: "mytheme"
|
|
167
|
-
}
|
|
171
|
+
site: { theme: "mytheme" }
|
|
168
172
|
}
|
|
169
173
|
```
|
|
170
174
|
|
|
171
|
-
|
|
175
|
+
In `app/globals.css`:
|
|
176
|
+
```css
|
|
177
|
+
@import "keystone-design-bootstrap/styles/fonts.css";
|
|
178
|
+
@import "keystone-design-bootstrap/styles/theme.css";
|
|
179
|
+
@import "keystone-design-bootstrap/styles/typography.css";
|
|
180
|
+
@import "keystone-design-bootstrap/styles/style-overrides.mytheme.css"; /* Your theme */
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Restart your dev server. Fonts are self-hosted via Fontsource and automatically loaded.
|
|
172
184
|
|
|
173
|
-
|
|
174
|
-
Use the exact same props interface as the base component
|
|
185
|
+
#### 5. Create Component Variants (Optional)
|
|
186
|
+
**CRITICAL:** Use the exact same props interface as the base component.
|
|
175
187
|
|
|
176
188
|
Check the base component first:
|
|
177
189
|
```typescript
|
|
178
190
|
// Check: src/design_system/sections/hero-home.tsx
|
|
179
191
|
interface HeroHomeProps {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
192
|
+
title?: string; // ← Use these exact prop names
|
|
193
|
+
subtitle?: string;
|
|
194
|
+
ctaText?: string;
|
|
195
|
+
ctaHref?: string;
|
|
183
196
|
}
|
|
184
197
|
```
|
|
185
198
|
|
|
186
|
-
|
|
199
|
+
Create variant with matching interface:
|
|
187
200
|
```typescript
|
|
188
201
|
// src/design_system/sections/hero-home.mytheme.tsx
|
|
189
|
-
export const HeroHome = ({
|
|
202
|
+
export const HeroHome = ({ title, subtitle, ctaText, ctaHref }: HeroHomeProps) => (
|
|
190
203
|
<section className="bg-primary py-20">
|
|
191
|
-
<h1 className="font-display text-display-xl">{
|
|
192
|
-
<p className="font-body text-lg">{
|
|
204
|
+
<h1 className="font-display text-display-xl">{title}</h1>
|
|
205
|
+
<p className="font-body text-lg">{subtitle}</p>
|
|
193
206
|
<Button href={ctaHref} color="primary" size="md">{ctaText}</Button>
|
|
194
207
|
</section>
|
|
195
208
|
);
|
|
@@ -198,8 +211,16 @@ import { registerThemeVariant } from '../../lib/component-registry';
|
|
|
198
211
|
registerThemeVariant('hero-home', 'mytheme', HeroHome);
|
|
199
212
|
```
|
|
200
213
|
|
|
201
|
-
|
|
202
|
-
`src/design_system/sections/index.tsx`:
|
|
214
|
+
#### 6. Register Component Variants
|
|
215
|
+
In `src/design_system/sections/index.tsx`:
|
|
203
216
|
```typescript
|
|
204
217
|
import './hero-home.mytheme';
|
|
205
218
|
```
|
|
219
|
+
|
|
220
|
+
## Design Rules
|
|
221
|
+
|
|
222
|
+
- **Prop Consistency**: Theme variants MUST use identical props interface as base component
|
|
223
|
+
- **CSS Variables Only**: No hardcoded colors/fonts in components
|
|
224
|
+
- **Semantic Classes**: Use `bg-primary`, `text-fg-primary`, `font-display` (not hardcoded values)
|
|
225
|
+
- **Minimal Overrides**: Keep theme CSS files ~100 lines max
|
|
226
|
+
- **Dual Color Prefixes**: Mirror variables to both `--color-*` and `--background-*` prefixes for compatibility
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keystone-design-bootstrap",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "Keystone Design Bootstrap - Sections, Elements, and Theme System for customer websites",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"react-dom": ">=19.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
+
"@fontsource/inter": "^5.2.8",
|
|
46
|
+
"@fontsource/merriweather": "^5.2.11",
|
|
47
|
+
"@fontsource/playfair-display": "^5.2.8",
|
|
48
|
+
"@fontsource/poppins": "^5.2.7",
|
|
45
49
|
"@untitledui/icons": "^0.0.19",
|
|
46
50
|
"clsx": "^2.1.1",
|
|
47
51
|
"embla-carousel-react": "^8.6.0",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Fonts
|
|
3
|
+
* Self-hosted via Fontsource for better performance and reliability
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* Aman Theme Fonts */
|
|
7
|
+
@import "@fontsource/inter/300.css";
|
|
8
|
+
@import "@fontsource/inter/400.css";
|
|
9
|
+
@import "@fontsource/inter/600.css";
|
|
10
|
+
@import "@fontsource/playfair-display/400.css";
|
|
11
|
+
@import "@fontsource/playfair-display/700.css";
|
|
12
|
+
|
|
13
|
+
/* Barelux Theme Fonts */
|
|
14
|
+
@import "@fontsource/merriweather/300.css";
|
|
15
|
+
@import "@fontsource/merriweather/400.css";
|
|
16
|
+
@import "@fontsource/merriweather/700.css";
|
|
17
|
+
@import "@fontsource/poppins/300.css";
|
|
18
|
+
@import "@fontsource/poppins/400.css";
|
|
19
|
+
@import "@fontsource/poppins/500.css";
|
|
20
|
+
@import "@fontsource/poppins/600.css";
|
|
21
|
+
@import "@fontsource/poppins/700.css";
|
package/src/styles/theme.css
CHANGED
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
* Contains the colors and utilities used by the site template
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/* Import fonts for all themes */
|
|
7
|
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Playfair+Display:wght@400;700&display=swap');
|
|
8
|
-
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700&family=Poppins:wght@300;400;500;600;700&display=swap');
|
|
9
|
-
|
|
10
6
|
@theme {
|
|
11
7
|
/* ==================== FONTS ==================== */
|
|
12
8
|
--font-body: var(--font-inter, "Inter"), -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|