@layout-lib/react 0.1.0 → 0.1.1
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 +67 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -46,6 +46,73 @@ export default function RootLayout({ children }) {
|
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
## Theming the panel
|
|
50
|
+
|
|
51
|
+
Six built-in themes, plus `auto` (the default), which follows the operating system live: `dark`, `light`, `midnight`, `slate`, `solar`, `mono`.
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<LayoutGrid theme="midnight" />
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Every colour can be replaced on top of the theme. Anything you leave out keeps the theme's value, and `accent` defaults to the grid colour:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<LayoutGrid
|
|
61
|
+
theme="dark"
|
|
62
|
+
palette={{
|
|
63
|
+
bg: "#101828",
|
|
64
|
+
field: "#1d2939",
|
|
65
|
+
rail: "#344054",
|
|
66
|
+
line: "#1d2939",
|
|
67
|
+
text: "#f9fafb",
|
|
68
|
+
muted: "#98a2b3",
|
|
69
|
+
accent: "#7c5cff",
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Options
|
|
75
|
+
|
|
76
|
+
| Option | Default | Role |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `breakpoints` | mobile / tablet / desktop | One grid per breakpoint. |
|
|
79
|
+
| `visible` | `false` | Show the grid on load. |
|
|
80
|
+
| `theme` | `"auto"` | Panel theme (see above). |
|
|
81
|
+
| `palette` | `{}` | Override any panel colour. |
|
|
82
|
+
| `panel` | `true` | Mount the settings panel. |
|
|
83
|
+
| `panelOpen` | `true` | Start with the panel unfolded. |
|
|
84
|
+
| `baseline` | `8` | Vertical rhythm in px, or `false`. |
|
|
85
|
+
| `color` | `"#ff3b6b"` | Grid colour. |
|
|
86
|
+
| `opacity` | `0.12` | Column opacity. |
|
|
87
|
+
| `toggleKey` | `"g"` | Toggle key, with Ctrl + Shift. |
|
|
88
|
+
| `panelKey` | `"p"` | Panel fold key, with Ctrl + Shift. |
|
|
89
|
+
| `persist` | `true` | Remember tweaks in `localStorage`. |
|
|
90
|
+
| `storageKey` | `"layout-lib:overlay"` | Storage key. |
|
|
91
|
+
| `zIndex` | `2147483000` | Above everything, by default. |
|
|
92
|
+
| `container` | `document.body` | Where the shadow host is appended. |
|
|
93
|
+
| `enabled` | dev only | Force the overlay on or off. |
|
|
94
|
+
|
|
95
|
+
## Your config, versioned
|
|
96
|
+
|
|
97
|
+
Tune the grid with the mouse, hit "copy config", paste the result into your repo:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
// layout.config.ts
|
|
101
|
+
import type { Breakpoint } from "@layout-lib/core";
|
|
102
|
+
|
|
103
|
+
export const breakpoints: Breakpoint[] = [
|
|
104
|
+
{ name: "mobile", minWidth: 0, grid: { columns: 4, gutter: 16, margin: 16, maxWidth: null } },
|
|
105
|
+
{ name: "tablet", minWidth: 768, grid: { columns: 8, gutter: 24, margin: 32, maxWidth: null } },
|
|
106
|
+
{ name: "desktop", minWidth: 1280, grid: { columns: 12, gutter: 24, margin: 64, maxWidth: 1440 } },
|
|
107
|
+
];
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
<LayoutGrid breakpoints={breakpoints} />
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
A breakpoint applies from its `minWidth` upwards, and `maxWidth: null` keeps the grid fluid. Panel tweaks are remembered in the browser, but the code wins: edit that file and the stored settings are dropped.
|
|
115
|
+
|
|
49
116
|
## Driving it from your code
|
|
50
117
|
|
|
51
118
|
```tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layout-lib/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Responsive layout grid overlay for React, Next.js and Vite.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@layout-lib/core": "0.1.
|
|
21
|
+
"@layout-lib/core": "0.1.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": ">=18"
|