0.3.11 ā€¢ Published 1 day ago

@gyldendal/kobber-base v0.3.11

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

Base

šŸ› ļø Usage

Design tokens can be imported as json, css variables or sass variables:

import * as tokens from "~@gyldendal/kobber-base/themes/default/tokens";

export const Button = styled.button`
    background-color: ${tokens.component.button.color.background};
`;
@import "~@gyldendal/kobber-base/themes/default/tokens.css";

.button {
    background-color: var(--kobber-component-button-color-background);
}
@use "~@gyldendal/kobber-base/themes/default/tokens.scss" as tokens;

.button {
    background-color: tokens.$component-button-color-background;
}

Typography can be applied directly to HTML using CSS classes or by using composes in css modules:

<style>@import "~@gyldendal/kobber-base/themes/default/typography.css";</style>

<h1 class="kobber-typography-heading-xl">Heading</h1>
.my-heading {
  composes: headingXxl from "~@gyldendal/kobber-base/themes/default/typography.module.css";
}

Also see the typography component from @gyldendal/kobber-components:

import { ThemeProvider, Typography } from "~@gyldendal/kobber-base/react";

<ThemeProvider variant="default">
    <Typography component="h1" variant="headingXxl" />
</TheThemeProviderme>

āš” Quick how to: update tokens

  1. In Figma, make sure "reference mode in variables" is enabled for the design tokens plugin
  2. Export json from Figma
  3. Replace json in tokens-from-figma.json
  4. Run yarn build
  5. Commit changes

šŸ§± Token folder structure

/
ā”œā”€ā”€ themes/
ā”‚   ā”œā”€ā”€ tokens.css
ā”‚   ā”œā”€ā”€ tokens.scss
ā”‚   ā””ā”€ā”€ token.json
ā”œā”€ā”€ build-tokens.ts
ā”œā”€ā”€ config.ts
ā””ā”€ā”€ tokens-from-figma.json

We use style-dictionary to transform and format the tokens in ./tokens-from-figma.json.

In ./config.ts we decide which formats we want (css, scss, js and more), and in ./build-tokens.ts we can create formatters and use other utilities to change the output how we want.

The files in ./themes are auto generated and should never be edited manually.

0.3.11

1 day ago

0.3.10

12 days ago

0.3.9

25 days ago

0.3.8

27 days ago

0.3.7

1 month ago

0.3.6

2 months ago

0.3.5

2 months ago

0.3.3

2 months ago

0.3.0

5 months ago

0.3.2

5 months ago

0.3.1

5 months ago

0.2.0

5 months ago

0.1.0

5 months ago

0.0.1

6 months ago