From ed26033b11c9be640563a3ea30a38c9808cc822d Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Fri, 10 Jan 2025 15:51:53 +0300 Subject: [PATCH] Add args parsing --- frontend/src/components/meta/VButton.stories.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/meta/VButton.stories.js b/frontend/src/components/meta/VButton.stories.js index e850a47d89c..aa56e3f9180 100644 --- a/frontend/src/components/meta/VButton.stories.js +++ b/frontend/src/components/meta/VButton.stories.js @@ -51,7 +51,14 @@ export default { const Template = (args) => ({ components: { VButton }, setup() { - const { size, variant, ...rest } = args + const urlParams = new URLSearchParams(window.location.search) + const urlArgs = urlParams + .get("args") + .split(";") + .map((arg) => arg.split(":")) + for (const [key, value] of urlArgs) { + args[key] = value + } return () => h("div", { class: "flex" }, [ h( @@ -60,18 +67,18 @@ const Template = (args) => ({ id: "wrapper", class: [ "px-4 h-16 flex items-center justify-center", - variant.startsWith("transparent") ? "bg-surface" : "bg-default", + args.variant.startsWith("transparent") + ? "bg-surface" + : "bg-default", ], }, [ h( VButton, { - size, - variant, class: "description-bold", href: "/", - ...rest, + ...args, }, () => "Code is Poetry" ),