Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(UNTRACKED): chromatic visual non regression #4940

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/unlucky-cats-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-config-storybook-lib': minor
---

feat: use icons from talend/icons and not from unpkg
30 changes: 0 additions & 30 deletions packages/icons/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
const fs = require('fs/promises');
const path = require('path');

module.exports = {
webpackFinal: async config => {
const spriteAll = await fs.readFile(path.resolve(__dirname, '../dist/svg-bundle/all.svg'), {
encoding: 'utf8',
});
const spriteXS = await fs.readFile(path.resolve(__dirname, '../dist/svg-bundle/XS.svg'), {
encoding: 'utf8',
});
const spriteS = await fs.readFile(path.resolve(__dirname, '../dist/svg-bundle/S.svg'), {
encoding: 'utf8',
});
const spriteM = await fs.readFile(path.resolve(__dirname, '../dist/svg-bundle/M.svg'), {
encoding: 'utf8',
});
const spriteL = await fs.readFile(path.resolve(__dirname, '../dist/svg-bundle/L.svg'), {
encoding: 'utf8',
});
config.plugins.forEach(plugin => {
if (plugin.constructor.name.includes('HtmlWebpackPlugin')) {
const htmlPlugin = plugin;
htmlPlugin.userOptions.templateParameters.bodyHtmlSnippet += spriteAll;
htmlPlugin.userOptions.templateParameters.bodyHtmlSnippet += spriteXS;
htmlPlugin.userOptions.templateParameters.bodyHtmlSnippet += spriteS;
htmlPlugin.userOptions.templateParameters.bodyHtmlSnippet += spriteM;
htmlPlugin.userOptions.templateParameters.bodyHtmlSnippet += spriteL;
return htmlPlugin;
}
return plugin;
});
return config;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const defaultMain = {
buildStoriesJson: true,
},
stories: getStoriesFolders(),
staticDirs: [path.join(__dirname, 'msw')],
staticDirs: [path.join(__dirname, 'msw'), require.resolve('@talend/icons').replace('/dist/TalendIcons.js', '/dist/svg-bundle')],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-a11y',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ const defaultPreview = {
const storyElement = React.createElement(Story, {...context, key: 'story'});
return [
React.createElement(IconsProvider, {
key: 'icons-provider-decorator'
key: 'icons-provider-decorator',
bundles: [
'/all.svg',
'/XS.svg',
'/S.svg',
'/M.svg',
'/L.svg',
]
}),
React.createElement(ToggleBootstrap, {
disabled: context.globals.bootstrapTheme === 'false',
Expand Down
Loading