Skip to content

Commit

Permalink
feat: move dnb-ui-fonts package inside /style/themes/theme-ui/
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

- CSS Packages such as `dnb-ui-basis` and `dnb-ui-core` do not contain the fonts anymore. Fonts are now only a part of a theme file, such as: `/style/themes/theme-ui/dnb-theme-ui.*`.
- The CSS package `dnb-ui-fonts` is moved inside a theme folder `/themes/theme-ui`
  • Loading branch information
tujoworker committed Mar 1, 2023
1 parent d8d225e commit abb5ff7
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ $layout-large: map-get($breakpoints, 'large');

### Font

The DNB font is moved inside a subfolder in `/assets/fonts/dnb/...`. As long as you don't import them manually, you don't need to make any changes in your codebase.
The DNB font is moved inside a subfolder in `/assets/fonts/dnb/...`.

The CSS package `dnb-ui-fonts` is moved inside a theme folder `/themes/theme-ui`.

CSS Packages such as:

- `dnb-ui-basis`
- `dnb-ui-core`

do not contain the fonts anymore. Fonts are now only a part of a theme file, such as: `/style/themes/theme-ui/dnb-theme-ui.*`.

As long as you don't import them manually, you don't need to make any changes in your codebase.

### StepIndicator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You don't need to define the `font-family` ever, but rather use CSS Custom Prope

## Font Face

The DNB default Font Family is `DNB`. This font, together with it's weights is loaded and imported with `@font-face` in `/css/core/fonts.scss`. The font family is included in the library package.
The DNB default Font Family is `DNB`. This font, together with it's weights is loaded and imported with `@font-face` in `/css/core/themes/theme-ui/fonts.scss`. The font family is included in the library package.

## Spacing and margin collapsing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ There are several packages you can use and combine.
- Use it carefully - because this will effect existing styles as well.
- **dnb-ui-properties** - includes only the CSS Custom Properties.
- There is also a [JavaScript file containing](/uilib/usage/customisation/styling#a-list-of-all-css-properties) the same properties.
- **dnb-ui-fonts** - includes only the `@font-face` and properties.
- **dnb-ui-fonts** - includes only the `@font-face` and properties. You find this package is inside `/style/themes/theme-ui/`.

All the CSS packages are ready to use, **minified CSS files**. You will find the main style here: `@dnb/eufemia/style/dnb-ui-core.min.css`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ if (isCI) {
})

it('has to have correct core path to fonts', () => {
expect(global.core[0]).toMatch(
new RegExp('("|\\()../assets/fonts/dnb/')
)
expect(global.core[0]).not.toContain('/fonts/dnb/')
})
})

Expand Down Expand Up @@ -125,6 +123,12 @@ if (isCI) {
expect(global.theme[0]).not.toMatch(new RegExp('color:\\s?#007272;'))
expect(global.theme[0]).not.toContain('fuchsia')
})

it('has to have correct core path to fonts', () => {
expect(global.theme[0]).toMatch(
new RegExp('("|\\()../../../assets/fonts/dnb/')
)
})
})
} else {
it('skipping local tests', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default async function makeMainStyle() {
})

const listWithPackagesToProcess = await globby(
'./src/style/dnb-ui-*.scss'
'./src/style/**/dnb-ui-*.scss'
)
await asyncForEach(listWithPackagesToProcess, async (packageFile) => {
// in order to keep the folder structure, we have to add these asterisks
Expand Down
1 change: 0 additions & 1 deletion packages/dnb-eufemia/src/style/dnb-ui-basis.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@import './core/utilities.scss';
@import './core/properties.scss';
@import './core/scopes.scss';
@import './core/fonts.scss';
@import './core/helper-classes/helper-classes.scss';

// make sure we have dynamic root font size
Expand Down
1 change: 0 additions & 1 deletion packages/dnb-eufemia/src/style/dnb-ui-core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@import './core/utilities.scss';
@import './core/properties.scss';
@import './core/scopes.scss';
@import './core/fonts.scss';
@import './core/helper-classes/helper-classes.scss';
@include globalReset();

Expand Down
9 changes: 0 additions & 9 deletions packages/dnb-eufemia/src/style/dnb-ui-fonts.scss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

@import '../../core/utilities.scss';
@import '../../core/properties.scss';
@import './fonts.scss';

// import all the "class styles" of the elements
@import '../../elements/ui-elements.scss';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Import basis core parts
*
*/

// core imports
@import '../../core/utilities.scss';
@import '../../core/properties.scss';
@import './fonts.scss';
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
font-style: normal;
}

$fonts-path: '../../assets/fonts/dnb' !default;
$fonts-path: '../../../../assets/fonts/dnb' !default;

// Std and Regular
@font-face {
Expand Down

0 comments on commit abb5ff7

Please sign in to comment.