Skip to content

Commit

Permalink
Merge pull request #386 from storyblok/develop
Browse files Browse the repository at this point in the history
Release new storybook
  • Loading branch information
lisilinhart authored Mar 30, 2023
2 parents ffb2818 + e7ab33a commit 53936fe
Show file tree
Hide file tree
Showing 96 changed files with 4,648 additions and 8,708 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ module.exports = {
jest: true,
},
extends: [
'@vue/eslint-config-prettier',
'@vue/eslint-config-typescript',
'eslint:recommended',
'plugin:jest-dom/recommended',
'plugin:vue/vue3-essential',
'plugin:vue/vue3-recommended',
'plugin:vue/vue3-strongly-recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:jest-dom/recommended',
],
parser: 'vue-eslint-parser',
parserOptions: {
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run pre-commit
34 changes: 11 additions & 23 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
const { globalStyles } = require('../config/globals')

module.exports = {
core: {
builder: 'webpack5',
const config = {
framework: {
name: '@storybook/vue3-vite',
},
staticDirs: ['../public'],
stories: ['../stories/**/*.stories.js', '../src/**/*.stories.js'],
addons: ['@storybook/preset-scss', '@storybook/addon-essentials', '@storybook/addon-viewport', '@storybook/addon-a11y'],
// https://storybook.js.org/docs/configurations/custom-webpack-config/
webpackFinal: async (config) => {
config.module.rules.push({
test: /\.scss$/,
use: [
'sass-loader',
{
loader: 'style-resources-loader',
options: {
patterns: globalStyles,
},
},
],
})
stories: ['../stories/**/*.stories.@(ts|js|mdx)', '../src/**/*.stories.@(ts|js|mdx)'],
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y', '@storybook/addon-storysource'],
docs: {
autodocs: true,
defaultName: 'Documentation',
}
};

return config
},
}
export default config
3 changes: 2 additions & 1 deletion .storybook/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import storyblokTheme from './theme'

addons.setConfig({
theme: storyblokTheme,
addons: ['@storybook/addon-viewport', '@storybook/addon-a11y']
panelPosition: 'right',
addons: ['@storybook/addon-a11y']
})
5 changes: 5 additions & 0 deletions .storybook/preview.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ body {
.mr-20 {
margin-right: 20px;
}

.sb-show-main.sb-main-centered #storybook-root,
.sb-story {
width: 100%;
}
70 changes: 67 additions & 3 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,72 @@
import '../src/assets/styles/global.scss'
import './preview.css'
import BlokInkPlugin from '../src/main'
import { app } from '@storybook/vue3'
import { setup } from '@storybook/vue3';

app.use(BlokInkPlugin)
const customViewports = {
xxs: {
name: 'XXS',
styles: {
width: '320px',
height: '568px',
},
},
xs: {
name: 'XS',
styles: {
width: '480px',
height: '800px',
},
},
sm: {
name: 'SM',
styles: {
width: '640px',
height: '960px',
},
},
md: {
name: 'MD',
styles: {
width: '768px',
height: '1024px',
},
},
lg: {
name: 'LG',
styles: {
width: '1024px',
height: '768px',
},
},
xl: {
name: 'XL',
styles: {
width: '1280px',
height: '800px',
},
},
'2xl': {
name: '2XL',
styles: {
width: '1536px',
height: '864px',
},
},
}
setup((app) => {
app.use(BlokInkPlugin)
})

app.config.unwrapInjectedRef = true
export const parameters = {
options: {
storySort: {
method: '',
order: ['Introduction', 'Design', 'Basic', 'Forms', 'Navigation', 'Data', 'Interface'],
locales: '',
},
},
viewport: {
viewports: customViewports,
},
};
9 changes: 7 additions & 2 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-sass-guidelines"],

"plugins": ["stylelint-order"],
"plugins": ["stylelint-order", "stylelint-a11y"],

"rules": {
"max-nesting-depth": 4,
"max-nesting-depth": 3,
"a11y/selector-pseudo-class-focus": true,
"selector-max-id": 1,
"selector-max-compound-selectors": 4,
"selector-class-pattern": null,
Expand Down Expand Up @@ -39,6 +40,10 @@
"type": "at-rule",
"name": "media"
},
{
"type": "at-rule",
"name": "include"
},
"rules"
],
{ "severity": "warning" }
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ import '@storyblok/design-system/dist/storyblok-design-system.css'
app.use(BlokInk) // vue 3
```

Then you can use all Blok.Ink components everywhere in your app.

```vue
<template>
<SbIcon name="search" />
</template>
```

### Only install specific components

You can also only install a few components, by specifying the option `withComponents`.
```js
import BlokInk from '@storyblok/design-system'
import '@storyblok/design-system/dist/storyblok-design-system.css'

app.use(BlokInk, {
withComponents: [
'SbButton',
'SbIcon',
]
})
```


For more information on the usage of the Design System go to:
[https://www.storyblok.com/docs/guide/in-depth/design-system](https://www.storyblok.com/docs/guide/in-depth/design-system)

Expand Down
8 changes: 2 additions & 6 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
module.exports = {
presets: [
[
'@vue/cli-plugin-babel/preset',
{
useBuiltIns: false,
},
],
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
}
10 changes: 0 additions & 10 deletions config/globals.js

This file was deleted.

32 changes: 31 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
module.exports = {
preset: '@vue/cli-plugin-unit-jest',
testEnvironment: 'jsdom',
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx', 'vue'],
transform: {
'^.+\\.vue$': '@vue/vue3-jest',
'.+\\.(css|styl|less|sass|scss|jpg|jpeg|png|svg|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|avif)$':
require.resolve('jest-transform-stub'),
'^.+\\.(j|t)sx?$': [
require.resolve('ts-jest'),
{
babelConfig: true,
useESM: true,
tsconfig: './tsconfig.jest.json',
diagnostics: {
exclude: ['**'],
},
},
],
},
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1',
'^@/(.*)$': '<rootDir>/src/$1',
'^@tests/(.*)$': '<rootDir>/src/tests/$1',
'^vue$': '<rootDir>/node_modules/vue',
},
testMatch: [
'<rootDir>/src/**/*.(test|specs|spec).(js|jsx|ts|tsx)|<rootDir>/__tests__/*.(js|jsx|ts|tsx)',
'<rootDir>/tests/unit/**/*.spec.[jt]s?(x)',
],
transformIgnorePatterns: [
// ignores popper lib
'node_modules/(?!(@popperjs)/)',
],
setupFilesAfterEnv: ['<rootDir>/setup-jest.js'],
testEnvironmentOptions: {
customExportConditions: ['node', 'node-addons'],
},
}
Loading

0 comments on commit 53936fe

Please sign in to comment.