1.0.5 • Published 15 days ago

@ilo-org/styles v1.0.5

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
15 days ago

ILO Design System - Styles Package

Status: Proof of Concept

This package provides the stylesheets which are used to style components in other packages. It does this primarily by supplying a theme and other customization options to the @un/styles package SASS. It also includes custom css for components in cases where the desired styles can't be achieved only by configuring @un/styles.

Prefixing

All stylesheets in @un/core are prefixed via SASS variables. This prefix should correspond with the one used in the component classnames in order for styles to be configured correctly. To see prefixes:

// Set prefix on default styles
@use "@un/styles/scss/config" with (
  $prefix: "ilo"
);

// Set prefix on default theme options
@use "@un/themes/scss/themes" as themes with (
  $custom-property-prefix: "ilo"
);

CSS Reset

@un/styles includes a basic CSS reset that can be added like this.

@forward "@un/styles/scss/reset";

Theming

UN Core is based on IBM Carbon, so themeing works the same way.

Here is an example of the theme used in this POC, which essentially just WFP's theme with a few values changed. Below shows how we use the theme to customize styles.

As you can see, a theme is simply a large map of style tokens which are consumed at various places by the @un/styles packages.

// Import our own theme settings
@use "theme" as theme;

// Apply the theme settings to the default styles
$carbon--theme: theme.$carbon--theme--ilo;
:root {
  @include themes.carbon--theme(theme.$carbon--theme--ilo, true) {
  }
}

Styling components

We can accomplish a lot by customizing style tokens, but we will probably also need to apply more specific styles to components.

Applying styles

We can use the default styles for an individual component simply by adding its scss from the @un/styles package.

@forward "@un/styles/scss/components/button";

Note that some components (like Button) may also have their own set of tokens that we can customize like this:

@use "@un/styles/scss/components/button" with (
  $button-height: 2.5rem,
  $button-border-radius: 2px,
  $button-padding: 5px,
  $button-padding-lg: 0
);

Obviously, in addition to this, we can override or apply new styles to the component simply by writing our own stylesheets for them. There may be cases where we don't even want to use the default styles, and so we can forgo importing them for a given component.

1.0.5

15 days ago

1.0.4

23 days ago

1.0.3

27 days ago

1.0.2

1 month ago

1.0.1

1 month ago

1.0.0

1 month ago

0.16.1

2 months ago

0.16.0

2 months ago

0.15.0

2 months ago

0.14.2

3 months ago

0.14.1

3 months ago

0.14.0

3 months ago

0.13.3

3 months ago

0.13.2

4 months ago

0.13.1

4 months ago

0.13.0

5 months ago

0.12.0

6 months ago

0.8.4

9 months ago

0.11.3-next.0

6 months ago

0.11.0

8 months ago

0.11.1

7 months ago

0.11.2

7 months ago

0.11.3-next.2

6 months ago

0.11.3-next.1

6 months ago

0.11.3-next.3

6 months ago

0.9.0

9 months ago

0.7.2

9 months ago

0.7.1

9 months ago

0.9.2

8 months ago

0.9.1

9 months ago

0.5.0

10 months ago

0.7.0

10 months ago

0.10.1

8 months ago

0.10.2

8 months ago

0.10.3

8 months ago

0.10.4

8 months ago

0.10.5

8 months ago

0.10.6

8 months ago

0.10.0

8 months ago

0.8.1

9 months ago

0.8.0

9 months ago

0.8.3

9 months ago

0.8.2

9 months ago

0.4.0

11 months ago

0.6.1

10 months ago

0.6.0

10 months ago

0.3.5

11 months ago

0.3.4

11 months ago

0.3.3

11 months ago

0.3.0

1 year ago

0.3.2

12 months ago

0.3.1

12 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.17

1 year ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.16

1 year ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.1.4

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago