Skip to content

Commit

Permalink
feat(StylisPlugin): removes stylis plugin (#2156)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

Stylis plugin, `import stylisPlugin from '@dnb/eufemia/style/stylis'`, has been removed.
  • Loading branch information
langz authored and tujoworker committed May 31, 2023
1 parent 3ba8a2e commit 8c96969
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ Find the SCSS @mixin `removeFakeFocus` and replace it with `removeFocusRing`.
- `import { SpacingHelper } from '@dnb/eufemia/shared'` was removed due to low usage. Use one of the [other exported helpers](/uilib/usage/layout/spacing).
- `import { LocaleProps, DataAttributeTypes, DynamicElement } from '@dnb/eufemia/shared/interfaces'` was removed, and moved to `@dnb/eufemia/shared/types`.
- `isIE11` and `IS_IE11` is deprecated as we have stopped supporting Internet Explorer (IE).
- Stylis plugin, `import stylisPlugin from '@dnb/eufemia/style/stylis'`, has been removed.

## Install

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ import cssVars from 'css-vars-ponyfill'
cssVars()
```

But on large applications, the polyfill lacks in stability, therefore we made and recommend using the approach by using the Stylis Plugin method. Se examples below.

### CSS Properties (variables)

You can also import all the main properties as a JavaScript Object:
Expand All @@ -63,54 +61,3 @@ You can also import all the main properties as a JavaScript Object:
import properties from '@dnb/eufemia/style/properties'
// properties gives you { '--color-sea-green': '#007272', ... }
```

### Styled Components

Is supported from v5 of [styled-components](https://www.styled-components.com) and above.

```jsx
import stylisPlugin from '@dnb/eufemia/style/stylis'
import { StyleSheetManager } from 'styled-components'

render(
<StyleSheetManager stylisPlugins={[stylisPlugin]}>
<MyApp />
</StyleSheetManager>
)
```

#### Add custom properties:

```jsx
import { withProperties } from '@dnb/eufemia/style/stylis'
import { StyleSheetManager } from 'styled-components'

const stylisPlugin = withProperties({
'--custom-property': 'CSS value',
})

render(
<StyleSheetManager stylisPlugins={[stylisPlugin]}>
<MyApp />
</StyleSheetManager>
)
```

### Emotion

```jsx
import stylisPlugin from '@dnb/eufemia/style/stylis'
import { CacheProvider } from '@emotion/react'
import createEmotionCache from '@emotion/cache'

const emotionCache = createEmotionCache({
key: 'my-prefix-key',
stylisPlugins: [stylisPlugin],
})

render(
<CacheProvider value={emotionCache}>
<MyApp />
</CacheProvider>
)
```
69 changes: 0 additions & 69 deletions packages/dnb-eufemia/src/style/stylis.ts

This file was deleted.

0 comments on commit 8c96969

Please sign in to comment.