Skip to content

Commit

Permalink
build: make .utrecht-theme instead of :root the default selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbert committed May 13, 2022
1 parent 3f461a3 commit a4b70eb
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Combine it with the latest Web Components from the NL Design System community, f
Then you can go ahead and see the result:

```html
<utrecht-html-content>
<utrecht-html-content class="utrecht-theme">
<h1>Page styled with NL Design System</h1>
</utrecht-html-content>
```
Expand Down
2 changes: 1 addition & 1 deletion packages/component-library-formio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ To use the Utrecht theme for the components, include the design tokens CSS in yo
npm install --save-dev --save-exact @utrecht/design-tokens
```

Include the CSS variables in your page.
Include the CSS variables in your page, and apply the `utrecht-theme` class name.

```js
import "@utrecht/design-tokens/dist/index.css";
Expand Down
2 changes: 1 addition & 1 deletion packages/component-library-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import "@utrecht/component-library-css/dist/bem.css";

// Package with Utrecht design tokens for the white-label components
// Substitute with your another theme for other organisations.
import "@utrecht/design-tokens/dist/theme/index.css";
import "@utrecht/design-tokens/dist/index.css";

export const MyPage = () => (
// Class name to apply the design tokens from the theme
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/config/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineCustomElements } from '@utrecht/web-component-library-stencil';
import defaultsDeep from 'lodash.defaultsdeep';

import '@utrecht/components/document/css/index.scss';
import '@utrecht/design-tokens/dist/theme/index.css';
import '@utrecht/design-tokens/dist/index.css';
import '@utrecht/design-tokens/dist/property.css';
import '@utrecht/design-tokens/src/custom.scss';

Expand Down
2 changes: 1 addition & 1 deletion packages/web-component-library-angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ After this you can use web components in your templates:
<utrecht-paragraph>Hello world!</utrecht-paragraph>
```

To use the Utrecht theme for the components, include the design tokens CSS in your `angular.json`:
To use the Utrecht theme for the components, use the `utrecht-theme` class name and include the design tokens CSS in your `angular.json`:

```json
{
Expand Down
2 changes: 1 addition & 1 deletion packages/web-component-library-stencil/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Combine it with the latest Web Components (for convenience you can use the unpkg
Then you can go ahead and see the result:

```html
<utrecht-html-content>
<utrecht-html-content class="utrecht-theme">
<h1>Page styled with NL Design System</h1>
</utrecht-html-content>
```
Expand Down
2 changes: 1 addition & 1 deletion packages/web-component-library-vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ For example, in your `App.vue`:
Since the implementation of the web components needs to be loaded in the browser, include the following effect to import web component library from `@utrecht/web-component-library-stencil`, for example in your `main.js`:

```js
import "@utrecht/design-tokens/dist/theme/index.css";
import "@utrecht/design-tokens/dist/index.css";
import { defineCustomElements } from "@utrecht/web-component-library-stencil";

createApp(App).use(router).mount("#app");
Expand Down
12 changes: 10 additions & 2 deletions proprietary/design-tokens/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Design decisions at a component level, to make components look a very specific w

## Files in this package

### `dist/theme/index.css`
### `dist/index.css`

Opt-in way to apply all the CSS variables to HTML elements with the `utrecht-theme` class name:

Expand All @@ -41,7 +41,7 @@ Opt-in way to apply all the CSS variables to HTML elements with the `utrecht-the

This method is the preferred way to style the page.

### `dist/index.css`
### `dist/root.css`

Automatically applies all the CSS variables to HTML elements to the `:root` element:

Expand Down Expand Up @@ -111,6 +111,14 @@ To use the design tokens in your site via CSS variables, first include the desig
<link rel="stylesheet" href="https://unpkg.com/@utrecht/design-tokens/dist/index.css" />
```

Then add the `utrecht-theme` class name to your page:

```html
<html class="utrecht-theme">
...
</html>
```

Now the CSS variables will be available and you can use of all the design tokens:

```css
Expand Down
4 changes: 2 additions & 2 deletions proprietary/design-tokens/style-dictionary.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"buildPath": "dist/",
"files": [
{
"destination": "index.css",
"destination": "root.css",
"format": "css/variables",
"options": {
"outputReferences": true
Expand All @@ -48,7 +48,7 @@
"buildPath": "dist/",
"files": [
{
"destination": "theme/index.css",
"destination": "index.css",
"format": "css/variables",
"options": {
"selector": ".utrecht-theme",
Expand Down
2 changes: 1 addition & 1 deletion standalone/docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
},
theme: {
customCss: [
require.resolve('@utrecht/design-tokens/dist/theme/index.css'),
require.resolve('@utrecht/design-tokens/dist/index.css'),
require.resolve('./src/styles/custom.scss'),
],
},
Expand Down

0 comments on commit a4b70eb

Please sign in to comment.