Skip to content

Commit

Permalink
fix: remove sb decorator (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlnf authored May 1, 2024
1 parent 237029f commit 4925b92
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 52 deletions.
6 changes: 3 additions & 3 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module.exports = {
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-docs',
'@etchteam/storybook-addon-css-variables-theme',
'@storybook/addon-a11y'
// '@etchteam/storybook-addon-css-variables-theme',
'@storybook/addon-a11y',
],
framework: '@storybook/html',
staticDirs: [
Expand All @@ -31,4 +31,4 @@ module.exports = {
docs: {
docsPage: 'automatic',
},
}
};
50 changes: 25 additions & 25 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint-disable no-unused-vars */
/* eslint-disable import/no-webpack-loader-syntax */
import React from 'react'
import { DocsContainer } from '@storybook/addon-docs'
import cssVariablesTheme from '@etchteam/storybook-addon-css-variables-theme'
import React from 'react';
import { DocsContainer } from '@storybook/addon-docs';
// import cssVariablesTheme from '@etchteam/storybook-addon-css-variables-theme'

import hseTheme from '!!style-loader?injectType=lazyStyleTag!css-loader!./assets/themes/hse.css'
import agsTheme from '!!style-loader?injectType=lazyStyleTag!css-loader!./assets/themes/ags.css'
import defaultTheme from '!!style-loader?injectType=lazyStyleTag!css-loader!../storybook/dist/@ogcio/ogcio-ds.min.css'
let selectedTheme
import hseTheme from '!!style-loader?injectType=lazyStyleTag!css-loader!./assets/themes/hse.css';
import agsTheme from '!!style-loader?injectType=lazyStyleTag!css-loader!./assets/themes/ags.css';
import defaultTheme from '!!style-loader?injectType=lazyStyleTag!css-loader!../storybook/dist/@ogcio/ogcio-ds.min.css';
let selectedTheme;

export const decorators = [cssVariablesTheme]
// export const decorators = [cssVariablesTheme]

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand All @@ -31,8 +31,8 @@ export const parameters = {
docs: {
source: { format: false },
container: ({ children, context }) => {
let newContext
cssVariablesTheme((c) => (newContext = c), context)
let newContext;
cssVariablesTheme((c) => (newContext = c), context);

return (
<DocsContainer context={newContext}>
Expand Down Expand Up @@ -60,7 +60,7 @@ export const parameters = {
)}
{children}
</DocsContainer>
)
);
},
components: {
a: ({ children, ...args }) => (
Expand Down Expand Up @@ -166,39 +166,39 @@ export const parameters = {
],
},
},
}
};

///
/// Change logo according to the selected theme
///

document.addEventListener('storybookcssvariables:theme:change', (event) => {
// set theme selectedTheme variable to the current select theme
selectedTheme = event?.detail?.theme
loadLogo()
})
selectedTheme = event?.detail?.theme;
loadLogo();
});

window.addEventListener('DOMContentLoaded', (event) => {
// reload the logo when the DOM finish loading because
// the pages have an iframe inside that took longer
// to fully load
loadLogo()
})
loadLogo();
});

const loadLogo = () => {
const logo = document.getElementById('logo-image')
const logo = document.getElementById('logo-image');

if (logo) {
// to avoid errors when the iframe has not completed loading yet
if (selectedTheme === 'AGS theme') {
logo.src = './themes/ags.png'
logo.style = 'width: 166px;'
logo.src = './themes/ags.png';
logo.style = 'width: 166px;';
} else if (selectedTheme === 'HSE theme') {
logo.src = './themes/hse.png'
logo.style = 'width: 52px;'
logo.src = './themes/hse.png';
logo.style = 'width: 52px;';
} else {
logo.src = './@ogcio/assets/images/logo-full.png'
logo.style = 'width: 116px;'
logo.src = './@ogcio/assets/images/logo-full.png';
logo.style = 'width: 116px;';
}
}
}
};
31 changes: 11 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"package/**/*"
],
"sideEffects": [
"govie-esm/vendor/**"
"./package/govie-esm/vendor/**"
],
"sass": "./package/govie/all.scss",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion storybook/dist/@ogcio/ogcio-ds-ie.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion storybook/dist/@ogcio/ogcio-ds.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion storybook/dist/@ogcio/ogcio-ds.min.js

Large diffs are not rendered by default.

0 comments on commit 4925b92

Please sign in to comment.