@pokela/components 2.11.0 → 2.12.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 +1 -1
- package/guidelines/styles.md +20 -0
- package/package.json +2 -2
- package/styles/base.css +33 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pokela/components
|
|
2
2
|
|
|
3
|
-
React-komponentit: **Pokela Design System**, versio 2.
|
|
3
|
+
React-komponentit: **Pokela Design System**, versio 2.12.0.
|
|
4
4
|
|
|
5
5
|
> Generoitu hakemistosta `components/` — samoista tiedostoista joita sivusto
|
|
6
6
|
> ajaa. Älä muokkaa käsin: muutokset tehdään lähteeseen ja paketti
|
package/guidelines/styles.md
CHANGED
|
@@ -32,3 +32,23 @@ things in columns, never in pixels. `Col` takes the span per breakpoint.
|
|
|
32
32
|
|
|
33
33
|
**No icon libraries and no emoji.** Use `Icon`. <!-- generated:make-ikonit -->It draws its own 9 marks<!-- /generated --> on
|
|
34
34
|
a 16×16 grid with the same hairline as every border.
|
|
35
|
+
|
|
36
|
+
## Buttons
|
|
37
|
+
|
|
38
|
+
A button is a class, not a component: `btn` plus `btn--primary`, `btn--ghost`
|
|
39
|
+
or `btn--text`, on a `<button>` or an `<a>`. Use one primary per view. The
|
|
40
|
+
default size needs no class. Use `btn--s` in dense places such as a toolbar
|
|
41
|
+
above a table, and `btn--l` only for the one main action on a page. Text
|
|
42
|
+
buttons have one size. Keep at least `--space-12` between small buttons: each
|
|
43
|
+
one still has a 44 px touch area.
|
|
44
|
+
|
|
45
|
+
An icon-only button is `btn--icon` with `btn--primary` or `btn--ghost`, never
|
|
46
|
+
`btn--text`. Always give it an `aria-label`, because nothing on screen names it.
|
|
47
|
+
|
|
48
|
+
```jsx
|
|
49
|
+
<button type="button" className="btn btn--ghost btn--s">Filter</button>
|
|
50
|
+
<button type="button" className="btn btn--primary btn--icon btn--s" aria-label="New project">
|
|
51
|
+
<Icon name="plus" />
|
|
52
|
+
</button>
|
|
53
|
+
<a href="/contact" className="btn btn--primary btn--l">Get in touch <Icon name="arrow-right" /></a>
|
|
54
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pokela/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "React-komponentit: Pokela Design System. Generoitu tiedostoista components/, ei käsin ylläpidetty.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Veli-Matti Pokela",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"LICENSE"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@pokela/tokens": "^2.
|
|
30
|
+
"@pokela/tokens": "^2.12.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=18"
|
package/styles/base.css
CHANGED
|
@@ -168,6 +168,39 @@ a:hover { text-decoration: underline; text-underline-offset: var(--space-4); }
|
|
|
168
168
|
.btn--block { width: 100%; }
|
|
169
169
|
@media (min-width: 600px) { .btn--block { width: auto; } }
|
|
170
170
|
|
|
171
|
+
/* Koot (päätös 26). Oletus on m: 44 px, sama kuin --tap-min. s on
|
|
172
|
+
tiiviisiin näkymiin (työkalurivi), l sivun ainoaan päätoimintoon.
|
|
173
|
+
Kieli ei muutu koon mukana: viiva, paino ja käännös ovat samat.
|
|
174
|
+
Tekstinapilla ei ole kokoja, koska sillä ei ole pintaa. */
|
|
175
|
+
.btn--s {
|
|
176
|
+
position: relative;
|
|
177
|
+
min-height: var(--space-32);
|
|
178
|
+
padding: var(--space-8) var(--space-16);
|
|
179
|
+
}
|
|
180
|
+
/* Näkyvä 32 px, osuma-alue silti --tap-min: näkymätön laajennus ylös
|
|
181
|
+
ja alas. Siksi s-nappien väli on vähintään --space-12, muuten
|
|
182
|
+
alueet menevät päällekkäin. Laajennus lasketaan reunaviivan
|
|
183
|
+
sisäpuolelta (absoluuttinen asemointi alkaa padding-laatikosta),
|
|
184
|
+
joten viiva vähennetään. */
|
|
185
|
+
.btn--s::after {
|
|
186
|
+
content: '';
|
|
187
|
+
position: absolute;
|
|
188
|
+
inset: calc((var(--space-32) - var(--tap-min)) / 2 - var(--hairline)) calc(var(--hairline) * -1);
|
|
189
|
+
}
|
|
190
|
+
.btn--l {
|
|
191
|
+
min-height: var(--space-56);
|
|
192
|
+
padding: var(--space-16) var(--space-32);
|
|
193
|
+
font-size: var(--text-body);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Pelkkä ikoni: neliö, jonka sivu on napin korkeus. Nimi tulee aina
|
|
197
|
+
aria-labelilla, koska tekstiä ei ole. Vain primary ja ghost. */
|
|
198
|
+
.btn--icon { flex: none; width: var(--tap-min); padding: 0; }
|
|
199
|
+
.btn--icon.btn--s { width: var(--space-32); }
|
|
200
|
+
.btn--icon.btn--s::after { inset: calc((var(--space-32) - var(--tap-min)) / 2 - var(--hairline)); }
|
|
201
|
+
.btn--icon.btn--l { width: var(--space-56); }
|
|
202
|
+
.btn--icon.btn--l .icon { width: var(--icon-l); height: var(--icon-l); }
|
|
203
|
+
|
|
171
204
|
/* Hover = käännös. Reunaviiva tulee border-colorista, ei varjosta. */
|
|
172
205
|
.btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
|
|
173
206
|
.btn--primary:hover { background: var(--paper); color: var(--ink); }
|