Skip to content

Commit

Permalink
Add args parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Jan 10, 2025
1 parent 3597d68 commit ed26033
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions frontend/src/components/meta/VButton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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"
),
Expand Down

0 comments on commit ed26033

Please sign in to comment.