-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
271 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const LIB = '@offirmo-private/css--foundation' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 3 additions & 10 deletions
13
stack--2022/3-advanced--browser/css--foundation/src/elements/element--body.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
|
||
body { | ||
/* XXX to review compatible web apps?? | ||
* max width + centering = #1 most important styling according to https://jgthms.com/web-design-in-4-minutes/#centering | ||
/* max width + centering = #1 most important styling according to https://jgthms.com/web-design-in-4-minutes/#centering | ||
* (Of course full-viewport webapps will need to cancel those default styles) | ||
*/ | ||
max-width: var(--o⋄content-recommended-width); | ||
margin: 0 max(1ch, (100vw - var(--o⋄content-recommended-width))/2); /* intelligent centering with a minimum margin for small screens */ | ||
|
||
/* no padding needed since space is provided by this various margins: | ||
* vertical: content blocks have their own margins, ex. headers, paragraphs... | ||
* horizontal: not needed thanks to to the intelligent centering above featuring a minimum margin | ||
* see also https://www.miriamsuzanne.com/2022/07/04/body-margin-8px/ | ||
*/ | ||
padding: 0; | ||
} | ||
|
||
/* TODO review | ||
html, body { | ||
height: 100%; | ||
min-height: 100%; | ||
width: 100%; | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
stack--2022/3-advanced--browser/css--foundation/src/elements/element--meter.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* This element has its own color (green) | ||
* we tweak it to follow the theme. | ||
*/ | ||
|
||
meter { | ||
/* TODO | ||
very seldom used, progress is more common | ||
https://stackoverflow.com/questions/8094835/how-to-style-html5-meter-tag | ||
https://css-tricks.com/html5-meter-element/ | ||
*/ | ||
} |
2 changes: 1 addition & 1 deletion
2
stack--2022/3-advanced--browser/css--foundation/src/elements/element--nav.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
/* Assume list in a nav is an horizontal list | ||
*/ | ||
|
||
nav { | ||
|
||
&:is(ol, ul) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
stack--2022/3-advanced--browser/css--foundation/src/vars--const/consts--colors--defaults.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
stack--2022/3-advanced--browser/css--foundation/src/vars--tokens/tokens--colors.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { All as Anchors } from '@offirmo-private/storypad/src/shared/stories/html/elements/a.stories' | ||
|
||
//////////////////////////////////////////////////////////////////////////////////// | ||
|
||
// Table of colors defined as CSS variables | ||
function ColorsAsCSSVariablesTable({radixes, caption}: { radixes: string[], caption: string }) { | ||
console.log({ | ||
radixes, | ||
caption, | ||
}) | ||
|
||
return ` | ||
<table style="border: 1px solid var(--o⋄color⁚fg--main);"> | ||
<caption>⬇${ caption }⬇</caption> | ||
<thead> | ||
<tr> | ||
<th scope='col'>CSS variable</th> | ||
<th scope='col'>foreground</th> | ||
<th scope='col'>background</th> | ||
<th scope='col'>default (if any)</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
${radixes.map(radix => { | ||
const css_var = `--o⋄color⁚` + radix | ||
return ` | ||
<tr key=${ radix } style="background-color: white;"> | ||
<td style="text-align: start; font-family: monospace;">${ css_var }</td> | ||
${ | ||
radix.startsWith('bg--') | ||
? `<td>-</td>` | ||
: `<td style="color: var(${ css_var })">as foreground</td>` | ||
} | ||
${ | ||
radix.startsWith('fg--') | ||
? `<td>-</td>` | ||
: `<td style="background-color: var(${ css_var })">as background</td>` | ||
} | ||
${ | ||
radix.startsWith('bg--') | ||
? `<td style="background-color: var(${ css_var }--default)">as background</td>` | ||
: `<td style="color: var(${ css_var }--default)">as foreground</td>` | ||
} | ||
</tr> | ||
` | ||
}).join('\n') } | ||
</tbody> | ||
</table> | ||
` | ||
} | ||
|
||
export function ColorsꓽSemantic() { | ||
|
||
const SEMANTIC_COLORS_VARS_RADIX = [ | ||
'fg--main', | ||
'fg--strong', | ||
'fg--link', | ||
'fg--link--visited', | ||
|
||
'fg--activity-outline', | ||
//'fg--warning', | ||
//'fg--info', | ||
//'fg--success', | ||
|
||
'bg--main', | ||
'bg--code', | ||
'bg--highlight--1', | ||
'bg--highlight--2', | ||
|
||
'fg--accent', | ||
] | ||
|
||
return ColorsAsCSSVariablesTable({ | ||
radixes: SEMANTIC_COLORS_VARS_RADIX, | ||
caption: 'Semantic colors from CSS variables', | ||
}) | ||
} | ||
|
||
|
||
export function ColorsꓽColoredElements() { | ||
|
||
return ` | ||
${ Anchors() } | ||
<br> | ||
<meter min=0 low=25 high=50 optimum=75 max=100 value=0></meter> | ||
<meter min=0 low=25 high=50 optimum=75 max=100 value=24></meter> | ||
<meter min=0 low=25 high=50 optimum=75 max=100 value=49></meter> | ||
<meter min=0 low=25 high=50 optimum=75 max=100 value=74></meter> | ||
<meter min=0 low=25 high=50 optimum=75 max=100 value=100></meter> | ||
<br> | ||
<progress max=100></progress><br> | ||
<progress max=100 value=0></progress><br> | ||
<progress max=100 value=50></progress><br> | ||
<progress max=100 value=100></progress> | ||
<br> | ||
` | ||
} |
Oops, something went wrong.