generated from nl-design-system/example
-
Notifications
You must be signed in to change notification settings - Fork 12
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
8 changed files
with
146 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!-- | ||
@license EUPL-1.2 | ||
Copyright (c) 2021 Robbert Broersma | ||
--> | ||
|
||
# Surface component | ||
|
||
The surface component can be used to style the background color of the entire viewport. | ||
|
||
The CSS class name is `utrecht-surface`. |
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,20 @@ | ||
/** | ||
* @license EUPL-1.2 | ||
* Copyright (c) 2021 Robbert Broersma | ||
*/ | ||
|
||
@mixin reset-body { | ||
margin-block-end: 0; | ||
margin-block-start: 0; | ||
margin-inline-end: 0; | ||
margin-inline-start: 0; | ||
} | ||
|
||
.utrecht-surface { | ||
background-color: var(--utrecht-surface-background-color, inherit); | ||
color: var(--utrecht-surface-color, inherit); | ||
} | ||
|
||
.utrecht-surface--reset-body { | ||
@include reset-body; | ||
} |
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,18 @@ | ||
{ | ||
"utrecht": { | ||
"surface": { | ||
"background-color": { | ||
"css": { | ||
"syntax": "<color>", | ||
"inherits": true | ||
} | ||
}, | ||
"color": { | ||
"css": { | ||
"syntax": "<color>", | ||
"inherits": true | ||
} | ||
} | ||
} | ||
} | ||
} |
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,34 @@ | ||
<!-- | ||
@license EUPL-1.2 | ||
Copyright (c) 2021 Robbert Broersma | ||
--> | ||
|
||
import { Description, Meta, Source } from "@storybook/addon-docs"; | ||
import { ComponentTokensTable } from "../../documentation/components/ComponentTokensTable"; | ||
import { utrechtSurfaceBackgroundColor } from "../../proprietary/design-tokens/dist/index.js"; | ||
import tokens from "../../proprietary/design-tokens/dist/index.json"; | ||
import document from "./README.md"; | ||
|
||
<Meta title="CSS Component/Surface/README" /> | ||
|
||
<Description>{document}</Description> | ||
|
||
## Theme color | ||
|
||
To make the browser user interface match your websites surface background color, you can include the following code in the `<head>` element of your pages: | ||
|
||
<Source language="html" code={`<meta name="theme-color" content="${utrechtSurfaceBackgroundColor}">`} /> | ||
|
||
For projects that use JSX and React, the following code sample shows how to refer to the design token package to automatically use the most recent choice of color. | ||
|
||
```jsx | ||
import { utrechtSurfaceBackgroundColor } from "@utrecht/design-tokens/dist/index"; | ||
|
||
export const ThemeColor = () => <meta name="theme-color" content={utrechtSurfaceBackgroundColor} />; | ||
``` | ||
|
||
See for more information: [`theme-color` on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color) | ||
|
||
## Design Tokens | ||
|
||
<ComponentTokensTable tokens={tokens} component="utrecht-surface"></ComponentTokensTable> |
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,14 @@ | ||
/** | ||
* @license EUPL-1.2 | ||
* Copyright (c) 2021 Robbert Broersma | ||
*/ | ||
|
||
@import "./bem"; | ||
|
||
:host { | ||
display: block; | ||
} | ||
|
||
:host([hidden]) { | ||
display: none !important; | ||
} |
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,41 @@ | ||
<!-- | ||
@license EUPL-1.2 | ||
Copyright (c) 2021 Robbert Broersma | ||
--> | ||
|
||
import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs"; | ||
export const Template = ({ innerHTML }) => `<utrecht-surface>${innerHTML}</utrecht-surface>`; | ||
|
||
<Meta | ||
title="Web Component/Surface" | ||
argTypes={{ | ||
innerHTML: { | ||
description: "Surface content", | ||
control: "text", | ||
}, | ||
}} | ||
parameters={{ | ||
docs: { | ||
transformSource: (_src, { args }) => Template(args), | ||
}, | ||
layout: "fullscreen", | ||
status: { | ||
type: "WORK IN PROGRESS", | ||
}, | ||
}} | ||
/> | ||
|
||
# Surface component | ||
|
||
<Canvas> | ||
<Story | ||
name="Surface" | ||
args={{ | ||
innerHTML: "The Quick Brown Fox Jumps Over The Lazy Dog", | ||
}} | ||
> | ||
{Template.bind({})} | ||
</Story> | ||
</Canvas> | ||
|
||
<ArgsTable story="Surface" /> |
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
8 changes: 8 additions & 0 deletions
8
proprietary/design-tokens/src/component/utrecht/surface/block.tokens.json
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,8 @@ | ||
{ | ||
"utrecht": { | ||
"surface": { | ||
"background-color": { "value": "{utrecht.color.grey.95.value}" }, | ||
"color": { "value": "{utrecht.color.grey.10.value}" } | ||
} | ||
} | ||
} |