diff --git a/.storybook/decorators/full-width.ts b/.storybook/decorators/full-width.ts new file mode 100644 index 0000000000..65b9ec2d27 --- /dev/null +++ b/.storybook/decorators/full-width.ts @@ -0,0 +1,5 @@ +export default function fullWidth() { + return { + template: `
`, + }; +} diff --git a/.storybook/decorators/half-width.ts b/.storybook/decorators/half-width.ts new file mode 100644 index 0000000000..dc068c8b8c --- /dev/null +++ b/.storybook/decorators/half-width.ts @@ -0,0 +1,5 @@ +export default function halfWidth() { + return { + template: `
`, + }; +} diff --git a/src/displays/datetime/datetime.story.ts b/src/displays/datetime/datetime.story.ts new file mode 100644 index 0000000000..d33886654e --- /dev/null +++ b/src/displays/datetime/datetime.story.ts @@ -0,0 +1,35 @@ +import withPadding from '../../../.storybook/decorators/with-padding'; +import { withKnobs, date, select } from '@storybook/addon-knobs'; +import readme from './readme.md'; +import { defineComponent, ref, watch } from '@vue/composition-api'; + +export default { + title: 'Displays / Datetime', + decorators: [withPadding, withKnobs], + parameters: { + notes: readme, + }, +}; + +export const basic = () => + defineComponent({ + props: { + value: { + default: date('Value', new Date()), + }, + type: { + default: select('Type', ['date', 'time', 'datetime'], 'datetime'), + }, + }, + setup(props) { + const val = ref(new Date(props.value).toISOString()); + watch( + () => props.value, + () => (val.value = new Date(props.value).toISOString()) + ); + return { val }; + }, + template: ` + + `, + }); diff --git a/src/displays/datetime/datetime.vue b/src/displays/datetime/datetime.vue index a558ed3e6d..f42f7be2c7 100644 --- a/src/displays/datetime/datetime.vue +++ b/src/displays/datetime/datetime.vue @@ -3,7 +3,7 @@