Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add DpDatepicker to Storybook. #521

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/components/DpDatepicker/DpDatepicker.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Meta } from '@storybook/addon-docs'
import DpDatepicker from './'

<Meta
title="Components/Datepicker"
component={DpDatepicker}
/>

# Datepicker

The Datepicker component allows users to enter a date either by typing or by selecting a date from the calendar.

Use a date picker when you want to provide a view that allows the user to select a calendar date.

## Default usage

```html
<dp-datepicker
id="datepicker_id"
v-model="planDate" />
```
26 changes: 26 additions & 0 deletions src/components/DpDatepicker/DpDatepicker.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Meta, StoryObj } from '@storybook/vue'
import DpDatepicker from './'

const meta: Meta<typeof DpDatepicker> = {
component: DpDatepicker,
title: "Components/Datepicker",

}

interface IDpDatepicker {
id: string
input: object
}

type Story = StoryObj<IDpDatepicker>

export default meta

export const Default: Story = {
args: {
id: 'id'
},
argTypes: {
input: { action: 'input' },
}
}
12 changes: 12 additions & 0 deletions src/components/DpDatepicker/DpDatepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,26 @@ export default {
default: false
},

/**
* The ID of the Datepicker component is derived from this prop.
*/
id: {
type: String,
required: true
},

/**
* Upper date limit.
*/
maxDate: {
type: String,
required: false,
default: ''
},

/**
* Lower date limit.
*/
minDate: {
type: String,
required: false,
Expand All @@ -72,6 +81,9 @@ export default {
default: false
},

/**
* Expects ISO date
*/
value: {
type: String,
required: false,
Expand Down