@sb1/ffe-grid-react 100.8.3 → 100.10.0
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 +87 -19
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,38 +1,106 @@
|
|
|
1
1
|
# @sb1/ffe-grid-react
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Beskrivelse
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Grid-system for responsive layouts (foreldet - bruk CSS Grid eller Flexbox i stedet).
|
|
6
|
+
|
|
7
|
+
- `Grid` - Ytterste container som definerer grid-gapet
|
|
8
|
+
- `GridRow` - Rad-container med støtte for bakgrunnsfarge, margin og padding
|
|
9
|
+
- `GridCol` - Kolonne-container med responsiv bredde (12-kolonners system)
|
|
10
|
+
|
|
11
|
+
## Installasjon
|
|
12
|
+
|
|
13
|
+
```bash
|
|
6
14
|
npm install --save @sb1/ffe-grid-react
|
|
7
15
|
```
|
|
8
16
|
|
|
9
|
-
##
|
|
17
|
+
## Bruk
|
|
10
18
|
|
|
11
|
-
Full
|
|
19
|
+
Full dokumentasjon: https://sparebank1.github.io/designsystem/
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
Importer CSS:
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
```css
|
|
24
|
+
@import url('@sb1/ffe-grid/css/ffe-grid.css');
|
|
25
|
+
```
|
|
16
26
|
|
|
17
|
-
|
|
27
|
+
## Eksempler
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
### Import
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Grid, GridRow, GridCol } from '@sb1/ffe-grid-react';
|
|
22
33
|
```
|
|
23
34
|
|
|
24
|
-
|
|
35
|
+
### Grunnleggende eksempel
|
|
25
36
|
|
|
26
|
-
|
|
37
|
+
```tsx
|
|
38
|
+
<Grid>
|
|
39
|
+
<GridRow>
|
|
40
|
+
<GridCol sm={6}>Venstre kolonne</GridCol>
|
|
41
|
+
<GridCol sm={6}>Høyre kolonne</GridCol>
|
|
42
|
+
</GridRow>
|
|
43
|
+
</Grid>
|
|
44
|
+
```
|
|
27
45
|
|
|
28
|
-
|
|
46
|
+
### Responsiv layout med breakpoints
|
|
29
47
|
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
```tsx
|
|
49
|
+
<Grid>
|
|
50
|
+
<GridRow>
|
|
51
|
+
<GridCol sm={12} md={6} lg={4}>
|
|
52
|
+
Responsiv kolonne
|
|
53
|
+
</GridCol>
|
|
54
|
+
</GridRow>
|
|
55
|
+
</Grid>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Offset (forskyvning av kolonner)
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<GridCol
|
|
62
|
+
sm={{ cols: 10, offset: 1 }}
|
|
63
|
+
md={{ cols: 8, offset: 2 }}
|
|
64
|
+
lg={{ cols: 6, offset: 3 }}
|
|
65
|
+
>
|
|
66
|
+
Sentert innhold
|
|
67
|
+
</GridCol>
|
|
34
68
|
```
|
|
35
69
|
|
|
36
|
-
|
|
70
|
+
### Grid med spacing
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<Grid gap="lg">
|
|
74
|
+
<GridRow margin="md" padding="sm" bgColor="secondary">
|
|
75
|
+
<GridCol sm={6}>Kolonne 1</GridCol>
|
|
76
|
+
<GridCol sm={6}>Kolonne 2</GridCol>
|
|
77
|
+
</GridRow>
|
|
78
|
+
</Grid>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Responsiv spacing på GridRow
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<GridRow
|
|
85
|
+
sm={{ margin: 'sm', padding: 'xs' }}
|
|
86
|
+
md={{ margin: 'md', padding: 'sm' }}
|
|
87
|
+
lg={{ margin: 'lg', padding: 'md' }}
|
|
88
|
+
>
|
|
89
|
+
<GridCol sm={12}>Rad med responsiv spacing</GridCol>
|
|
90
|
+
</GridRow>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## DevTool: Grid overlay
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
import showGrid from '@sb1/ffe-grid-react/lib/show-grid';
|
|
97
|
+
window.showGrid = showGrid; // Toggle funksjon for grid overlay
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Utvikling
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install && npm run build && npm start
|
|
104
|
+
```
|
|
37
105
|
|
|
38
|
-
|
|
106
|
+
Lokal Storybook på http://localhost:6006/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-grid-react",
|
|
3
|
-
"version": "100.
|
|
3
|
+
"version": "100.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank1",
|
|
6
6
|
"files": [
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"test:watch": "ffe-buildtool jest --watch"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@sb1/ffe-grid": "^100.
|
|
27
|
+
"@sb1/ffe-grid": "^100.10.0",
|
|
28
28
|
"classnames": "^2.3.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@sb1/ffe-buildtool": "^100.
|
|
31
|
+
"@sb1/ffe-buildtool": "^100.10.0",
|
|
32
32
|
"react": "^18.2.0",
|
|
33
33
|
"react-dom": "^18.2.0"
|
|
34
34
|
},
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "efdd3866d59d794436a97a8dd6760f4c76466a71"
|
|
42
42
|
}
|