Skip to content

Commit

Permalink
Merge branch 'main' into VL-168_New-dynamic-radius-sizes_Vitalii-Dudnik
Browse files Browse the repository at this point in the history
  • Loading branch information
KinduD21 committed Dec 26, 2024
2 parents 1f5324e + fde0284 commit 1e2d897
Show file tree
Hide file tree
Showing 95 changed files with 821 additions and 1,759 deletions.
18 changes: 18 additions & 0 deletions .storybook/decorators/vue3SourceDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const vue3SourceDecorator = makeDecorator({
name: "vue3SourceDecorator",
wrapper: (storyFn, context) => {
const story = storyFn(context);
const urlArgs = getArgsFromUrl();
const [, updateArgs] = useArgs();

// this returns a new component that computes the source code when mounted
Expand All @@ -14,6 +15,8 @@ export const vue3SourceDecorator = makeDecorator({
components: { story },
setup() {
onMounted(async () => {
updateArgs({ ...context.args, ...urlArgs });

await setSourceCode();
});

Expand Down Expand Up @@ -133,3 +136,18 @@ function kebabCase(str) {
})
.join("");
}

function getArgsFromUrl() {
const params = new URLSearchParams(window.location.search);
const args = params.get("args");

if (!args) return {};

return args.split(";").reduce((acc, pair) => {
const [key, value] = pair.split(":");

acc[key] = decodeURIComponent(value);

return acc;
}, {});
}
5 changes: 1 addition & 4 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type { import('@storybook/vue3-vite').StorybookConfig } */
export default {
stories: ["../src/**/*stories.@(js|jsx|ts|tsx)", "../src/**/*.@(mdx)"],
stories: ["../src/**/*stories.@(js|jsx|ts|tsx)", "../src/**/docs.@(mdx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
Expand All @@ -17,9 +17,6 @@ export default {
},
},
},
docs: {
autodocs: true,
},
env: (config) => ({
...config,
BASE_URL: "/",
Expand Down
3 changes: 3 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ setup((app) => {
/* Set storybook decorators */
export const decorators = [vue3SourceDecorator, storyDarkModeDecorator()];

/* Set storybook tags */
export const tags = ["autodocs"];

/* Set storybook parameters */
export const parameters = {
layout: "fullscreen",
Expand Down
Loading

0 comments on commit 1e2d897

Please sign in to comment.