@ugurdemirel/landcraft 0.1.1 → 0.1.2
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 +103 -19
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +102 -4
- package/dist/index.js +1336 -1053
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3721 -5900
- package/package.json +5 -7
- package/src/components/Blog.tsx +18 -10
- package/src/components/Button.tsx +27 -8
- package/src/components/Footer.tsx +53 -13
- package/src/components/LanguageSwitcher.tsx +223 -0
- package/src/components/MegaMenu.tsx +15 -11
- package/src/components/Modal.tsx +124 -0
- package/src/components/Navbar.tsx +20 -8
- package/src/components/Slot.tsx +78 -0
- package/src/index.ts +9 -0
- package/src/styles/index.css +2 -71
- package/src/styles/theme.css +242 -0
- package/src/utils/iso2Flag.ts +26 -0
- package/tailwind.preset.cjs +0 -121
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ multiple visual options per component.
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
pnpm add @ugurdemirel/landcraft
|
|
11
|
-
# peers: react >=18, tailwindcss ^
|
|
11
|
+
# peers: react >=18, tailwindcss ^4
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
```tsx
|
|
@@ -16,15 +16,27 @@ import { Button, Hero } from "@ugurdemirel/landcraft";
|
|
|
16
16
|
import "@ugurdemirel/landcraft/styles.css";
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Add the
|
|
19
|
+
Add the theme to your own Tailwind v4 project by importing the CSS theme file
|
|
20
|
+
(no JS config or preset needed):
|
|
20
21
|
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
22
|
+
```css
|
|
23
|
+
/* app.css */
|
|
24
|
+
@import "tailwindcss";
|
|
25
|
+
@import "@ugurdemirel/landcraft/theme.css";
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
Then use Tailwind v4 as usual (`@tailwindcss/vite`, `@tailwindcss/postcss`, or
|
|
29
|
+
the CLI) — the theme registers every color/font/radius/shadow token and the
|
|
30
|
+
typography plugin automatically.
|
|
31
|
+
|
|
32
|
+
> Tailwind v4 auto-detects classes in your own source but skips `node_modules`.
|
|
33
|
+
> If you build the library's components from your own CSS (instead of importing
|
|
34
|
+
> `@ugurdemirel/landcraft/styles.css`), point detection at the package:
|
|
35
|
+
>
|
|
36
|
+
> ```css
|
|
37
|
+
> @source "../node_modules/@ugurdemirel/landcraft";
|
|
38
|
+
> ```
|
|
39
|
+
|
|
28
40
|
## Options
|
|
29
41
|
|
|
30
42
|
Every component accepts an `option` / `variant` prop — same API, different look:
|
|
@@ -44,30 +56,101 @@ Every component accepts an `option` / `variant` prop — same API, different loo
|
|
|
44
56
|
| Newsletter | `inline` · `card` · `underline` |
|
|
45
57
|
| Blog (BlogSection/BlogCard) | `card` · `row` (`limit` shows the latest N posts) |
|
|
46
58
|
|
|
47
|
-
|
|
59
|
+
**Brand mark.** `Navbar` and `Footer` accept a custom logo in place of the
|
|
60
|
+
wordmark: pass any node to `logo` (SVG, `<img>`, component…), or use
|
|
61
|
+
`logoSrc`/`logoAlt` for a quick image (`logoClassName` tunes its size, defaults
|
|
62
|
+
to `h-7 w-auto`).
|
|
63
|
+
|
|
64
|
+
## Theme / Customization
|
|
48
65
|
|
|
49
66
|
Every design decision lives on CSS custom properties on `:root` and can be
|
|
50
|
-
**overridden from outside** — color, type, radii and shadows
|
|
67
|
+
**overridden from outside** — color, type, radii and shadows. Override any token
|
|
68
|
+
in your own CSS after the library import and the whole library re-skins, no
|
|
69
|
+
JavaScript or build config required.
|
|
70
|
+
|
|
71
|
+
### Branding tokens (required for a custom look)
|
|
72
|
+
|
|
73
|
+
Override these to make the library match your brand. Every color token ships a
|
|
74
|
+
paired `--color-on-*` value; set them together so text stays readable.
|
|
51
75
|
|
|
52
76
|
| Token | Default | Role |
|
|
53
77
|
| --- | --- | --- |
|
|
54
|
-
| `--color-primary` | `79 70 229` | Primary accent |
|
|
78
|
+
| `--color-primary` | `79 70 229` | Primary accent (buttons, links, highlights) |
|
|
79
|
+
| `--color-primary-hover` | `67 56 202` | Primary hover / pressed |
|
|
80
|
+
| `--color-primary-soft` | `238 242 255` | Soft primary fills (badges, highlights) |
|
|
55
81
|
| `--color-on-primary` | `255 255 255` | Text on primary |
|
|
56
82
|
| `--color-secondary` | `15 15 15` | Ink surfaces (footer, statement, inverse) |
|
|
83
|
+
| `--color-secondary-hover` | `38 38 38` | Ink surface hover / pressed |
|
|
57
84
|
| `--color-on-secondary` | `250 250 250` | Text on ink surfaces |
|
|
58
85
|
| `--color-accent` | `5 150 105` | Promo / success |
|
|
59
|
-
| `--color-
|
|
60
|
-
| `--color-
|
|
86
|
+
| `--color-accent-hover` | `4 120 87` | Accent hover / pressed |
|
|
87
|
+
| `--color-on-accent` | `255 255 255` | Text on accent |
|
|
88
|
+
| `--font-display` | `"Space Grotesk", …` | Display / heading type |
|
|
89
|
+
| `--font-sans` | `"DM Sans", …` | Body type |
|
|
90
|
+
|
|
91
|
+
### Optional tokens
|
|
92
|
+
|
|
93
|
+
Everything below already works out of the box. Override only if you want to
|
|
94
|
+
fine-tune the neutral palette, semantics or fine-grained detail.
|
|
95
|
+
|
|
96
|
+
| Token | Default | Role |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `--color-background` | `250 250 250` | Page background (warm paper) |
|
|
61
99
|
| `--color-foreground` | `17 17 17` | Main text |
|
|
100
|
+
| `--color-muted-foreground` | `97 97 97` | Secondary / helper text |
|
|
62
101
|
| `--color-surface` | `255 255 255` | Card surface |
|
|
102
|
+
| `--color-surface-strong` | `244 244 242` | Inset / pressed surfaces, inline code bg |
|
|
63
103
|
| `--color-border` | `229 229 228` | Hairline borders |
|
|
64
|
-
| `--
|
|
65
|
-
| `--
|
|
66
|
-
| `--
|
|
67
|
-
| `--
|
|
104
|
+
| `--color-ring` | `79 70 229` | Focus rings |
|
|
105
|
+
| `--color-danger` | `217 45 32` | Negative trends |
|
|
106
|
+
| `--color-danger-soft` | `255 241 242` | Soft danger fills |
|
|
107
|
+
| `--radius-sm` · `--radius-md` · `--radius-lg` | `0.375rem` · `0.625rem` · `0.875rem` | Small / medium / large radii |
|
|
108
|
+
| `--radius-xl` · `--radius-2xl` · `--radius-3xl` | `1.125rem` · `1.5rem` · `2rem` | Large card / modal radii |
|
|
109
|
+
| `--shadow-soft` | `0 1px 2px rgb(17 17 17 / 0.04), 0 2px 8px …` | Subtle resting elevation |
|
|
110
|
+
| `--shadow-raised` | `0 2px 4px …, 0 12px 32px …` | Card / popup elevation |
|
|
111
|
+
| `--shadow-overlay` | `0 24px 64px -12px …` | Modal / floating surface |
|
|
112
|
+
|
|
113
|
+
### Overriding tokens
|
|
114
|
+
|
|
115
|
+
Tokens store space-separated RGB channels (`79 70 229`) so the library's
|
|
116
|
+
`rgb(var(--color-x))` inline styles and Tailwind's opacity modifiers
|
|
117
|
+
(`bg-primary/50`, compiled to `color-mix()` against the live token) keep working.
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
/* app.css */
|
|
121
|
+
@import "tailwindcss";
|
|
122
|
+
@import "@ugurdemirel/landcraft/theme.css";
|
|
123
|
+
|
|
124
|
+
:root {
|
|
125
|
+
/* Branding (required) */
|
|
126
|
+
--color-primary: 37 99 235; /* blue-600 */
|
|
127
|
+
--color-primary-hover: 29 78 216; /* blue-700 */
|
|
128
|
+
--color-primary-soft: 219 234 254; /* blue-100 */
|
|
129
|
+
--color-on-primary: 255 255 255;
|
|
130
|
+
--color-secondary: 15 23 42;
|
|
131
|
+
--color-secondary-hover: 30 41 59;
|
|
132
|
+
--color-on-secondary: 248 250 252;
|
|
133
|
+
--color-accent: 5 150 105;
|
|
134
|
+
--color-accent-hover: 4 120 87;
|
|
135
|
+
--color-on-accent: 255 255 255;
|
|
136
|
+
--font-display: "Inter", ui-sans-serif, system-ui, sans-serif;
|
|
137
|
+
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
|
|
138
|
+
|
|
139
|
+
/* Optional */
|
|
140
|
+
--color-background: 248 250 252;
|
|
141
|
+
--color-foreground: 15 23 42;
|
|
142
|
+
--color-muted-foreground: 100 116 139;
|
|
143
|
+
--color-surface: 255 255 255;
|
|
144
|
+
--color-border: 226 232 240;
|
|
145
|
+
--radius-2xl: 1.25rem;
|
|
146
|
+
--shadow-raised: 0 2px 4px rgb(15 23 42 / 0.06), 0 12px 32px rgb(15 23 42 / 0.1);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
68
149
|
|
|
69
|
-
|
|
70
|
-
(`bg-primary
|
|
150
|
+
Because the override targets the same custom property, every component — and any
|
|
151
|
+
Tailwind utility you write yourself (`bg-primary`, `text-muted-foreground`, …) —
|
|
152
|
+
picks it up immediately. Scope the overrides under `.dark` or a media query for
|
|
153
|
+
dark-mode variants.
|
|
71
154
|
|
|
72
155
|
### Contrast guarantees
|
|
73
156
|
|
|
@@ -123,7 +206,8 @@ import { Prose, ProseLead } from "@ugurdemirel/landcraft";
|
|
|
123
206
|
<Prose html={articleBody} />
|
|
124
207
|
```
|
|
125
208
|
|
|
126
|
-
Projects using the
|
|
209
|
+
Projects using the theme need `@tailwindcss/typography` (optional peer; the
|
|
210
|
+
`theme.css` import already registers it via `@plugin`).
|
|
127
211
|
|
|
128
212
|
## Components
|
|
129
213
|
|