Skip to content

Commit

Permalink
fix controls
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilReinking committed Nov 16, 2023
1 parent 7a8cf02 commit f5de031
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 48 deletions.
21 changes: 10 additions & 11 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
import "../styles/app.less";

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
darkMode: {
classTarget: 'html',
stylePreview: true
classTarget: "html",
stylePreview: true,
},
backgrounds: {
default: 'light',
default: "light",
values: [
{
name: 'white',
value: '#ffffff',
name: "white",
value: "#ffffff",
},
{
name: 'light',
value: '#f9f8f6',
name: "light",
value: "#f9f8f6",
},
{
name: 'dark',
value: '#0f172a',
name: "dark",
value: "#0f172a",
},
],
grid: {
Expand All @@ -36,4 +35,4 @@ export const parameters = {
offsetY: 16, // default is 0 if story has 'fullscreen' layout, 16 if layout is 'padded'
},
},
}
};
18 changes: 10 additions & 8 deletions src/Button/Button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ export default {
component: D9Button,
argTypes: {
color: {
control: {
type: "select",
options: ["primary", "light", "dark", "danger"],
},
options: ["primary", "light", "dark", "danger"],
control: "inline-radio",
},
size: {
control: { type: "select", options: ["small", "medium", "large"] },
options: ["small", "medium", "large"],
control: "inline-radio",
},
icon: { options: icons, control: "select" },
iconPosition: {
options: ["left", "right"],
control: "inline-radio",
},
icon: { control: { type: "select", options: icons } },
iconPosition: { control: { type: "select", options: ["left", "right"] } },
onClick: { action: "clicked" },
},
};
Expand All @@ -25,7 +27,7 @@ const Template = (args: Record<string, unknown>) => ({
setup() {
return { args };
},
template: '<d9-button v-bind="args" />',
template: '<D9Button v-bind="args" />',
});

export const Medium = Template.bind({});
Expand Down
2 changes: 1 addition & 1 deletion src/Checkbox/Checkbox.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Template = (args: Record<string, unknown>) => ({

return { args, checked };
},
template: '<d9-checkbox v-bind="args" v-model="checked" />',
template: '<D9Checkbox v-bind="args" v-model="checked" />',
});

export const WithLabel = Template.bind({});
Expand Down
8 changes: 5 additions & 3 deletions src/Icon/Icon.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ export default {
component: D9Icon,
argTypes: {
size: {
control: { type: "select", options: ["xs", "1x", "2x", "3x", "4x"] },
options: ["xs", "1x", "2x", "3x", "4x"],
control: { type: "inline-radio" },
},
name: {
control: { type: "select", options: [...icons, ...brands] },
options: [...icons, ...brands],
control: { type: "select" },
},
},
decorators: [
Expand All @@ -25,7 +27,7 @@ const Template = (args, { argTypes }) => ({
setup() {
return { args };
},
template: '<d9-icon v-bind="args" />',
template: '<D9Icon v-bind="args" />',
});

export const Primary = Template.bind({});
Expand Down
2 changes: 1 addition & 1 deletion src/Input/Input.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Template = (args) => ({
};
},
components: { D9Input },
template: `<div><d9-input v-bind="args" /></div>`,
template: `<div><D9Input v-bind="args" /></div>`,
});

export const Default = Template.bind({});
Expand Down
4 changes: 2 additions & 2 deletions src/Label/Label.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Default = (args: Record<string, unknown>) => ({
setup() {
return { args };
},
template: '<d9-label id="name" label="Your name" />',
template: '<D9Label id="name" label="Your name" />',
});

export const WithDescription = (args: Record<string, unknown>) => ({
Expand All @@ -19,5 +19,5 @@ export const WithDescription = (args: Record<string, unknown>) => ({
return { args };
},
template:
'<d9-label id="name" label="Your name" description="Please use your full name." />',
'<D9Label id="name" label="Your name" description="Please use your full name." />',
});
7 changes: 4 additions & 3 deletions src/Select/Select.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ export default {
component: D9Select,
argTypes: {
size: {
control: { type: "inline-radio" },
options: ["small", "medium", "large"],
control: "inline-radio",
},
icon: { control: { type: "select" }, options: icons },
icon: { options: icons, control: "select" },
modelValue: false,
},
};

Expand All @@ -34,7 +35,7 @@ const Template = (args) => ({
};
},
components: { D9Select },
template: `<div><d9-select class="inline-block w-56" v-bind="{ options: people, ...args}" /></div>`,
template: `<div><D9Select class="inline-block w-56" v-bind="{ options: people, ...args}" /></div>`,
});

export const Default = Template.bind({});
Expand Down
14 changes: 7 additions & 7 deletions src/Skeleton/Skeleton.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ export default {
component: D9Skeleton,
argTypes: {
title: {
control: { type: "boolean" },
control: "boolean",
},
footer: {
control: { type: "boolean" },
control: "boolean",
},
avatar: {
control: { type: "boolean" },
control: "boolean",
},
lines: {
control: { type: "number" },
control: "number",
},
},
};
Expand All @@ -24,7 +24,7 @@ const Template = (args: Record<string, unknown>) => ({
setup() {
return { args };
},
template: "<d9-skeleton class='text-grey-100' v-bind='args' />",
template: "<D9Skeleton class='text-grey-100' v-bind='args' />",
});

export const Default = Template.bind({});
Expand All @@ -40,5 +40,5 @@ Minimal.args = {
lines: 3,
footer: false,
title: true,
avatar: false
}
avatar: false,
};
2 changes: 1 addition & 1 deletion src/Spinner/Spinner.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Template = (args: Record<string, unknown>) => ({
setup() {
return { args };
},
template: "<d9-spinner class='text-grey-300' v-bind='args' />",
template: "<D9Spinner class='text-grey-300' v-bind='args' />",
});

export const Default = Template.bind({});
7 changes: 4 additions & 3 deletions src/SplitButton/SplitButton.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ export default {
argTypes: {
color: {
options: ["primary", "light", "dark", "danger"],
control: "inline-radio",
},
size: {
options: ["small", "medium", "large"],
control: "inline-radio",
},
icon: { options: icons, control: { type: "select" } },
iconPosition: { options: ["left", "right"] },
onClick: { action: "clicked" },
icon: { options: icons, control: "select" },
iconPosition: { options: ["left", "right"], control: "inline-radio" },
},
};

Expand Down
9 changes: 4 additions & 5 deletions src/SplitButton/SplitButton.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<template>
<div
class="relative inline-flex items-center focus:outline-none focus:ring active:ring transition duration-150 ease-in-out rounded-lg overflow-hidden"
>
<div class="relative inline-flex items-center">
<button
type="button"
:aria-label="label"
:tabindex="isDisabled ? '-1' : undefined"
class="relative"
class="relative transition duration-150 ease-in-out rounded-l-lg"
:class="buttonClasses"
@click="onClickMain"
>
Expand All @@ -22,7 +20,8 @@
</span>
</button>
<button
class="border-l-white/50 border-l"
type="button"
class="border-l-white/50 border-l transition duration-150 ease-in-out rounded-r-lg"
:class="[buttonClasses, splitButtonClasses]"
@click="onClickSplit"
>
Expand Down
2 changes: 1 addition & 1 deletion src/Switch/Switch.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Template = (args: Record<string, unknown>) => ({

return { args, enabled };
},
template: '<d9-switch v-bind="args" v-model="enabled" />',
template: '<D9Switch v-bind="args" v-model="enabled" />',
});

export const IsOff = Template.bind({});
Expand Down
4 changes: 2 additions & 2 deletions src/Textarea/Textarea.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
component: D9Textarea,
argTypes: {
size: {
control: { type: "inline-radio" },
control: "inline-radio",
options: ["small", "medium", "large"],
},
},
Expand All @@ -22,7 +22,7 @@ const Template = (args) => ({
};
},
components: { D9Textarea },
template: `<div><d9-textarea v-bind="args" /></div>`,
template: `<div><D9Textarea v-bind="args" /></div>`,
});

export const Default = Template.bind({});
Expand Down

0 comments on commit f5de031

Please sign in to comment.