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(docs): fix console warnings for DatePicker docs #6708

Merged
merged 3 commits into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 10 additions & 2 deletions packages/react/src/components/DatePicker/DatePicker-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,23 @@ export default {

export const Simple = () => (
<DatePicker datePickerType="simple">
<DatePickerInput placeholder="mm/dd/yyyy" labelText="Date Picker label" />
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-simple"
/>
</DatePicker>
);

Simple.storyName = 'simple';

export const Single = () => (
<DatePicker datePickerType="single">
<DatePickerInput placeholder="mm/dd/yyyy" labelText="Date Picker label" />
<DatePickerInput
placeholder="mm/dd/yyyy"
labelText="Date Picker label"
id="date-picker-single"
/>
</DatePicker>
);

Expand Down
42 changes: 35 additions & 7 deletions packages/react/src/components/DatePicker/DatePicker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ see the Flatpickr
[documentation](https://flatpickr.js.org/formatting/#date-formatting-tokens)

<DatePicker datePickerType="single" dateFormat="Y-m-d">
<DatePickerInput placeholder="yyyy-mm-dd" />
<DatePickerInput
placeholder="yyyy-mm-dd"
id="date-picker-1"
labelText="Date format example"
/>
</DatePicker>

```jsx
Expand Down Expand Up @@ -142,7 +146,11 @@ FlatPickr instance. A complete list of valid locales can be found in the
[component API](#component-api) section

<DatePicker locale="no" dateFormat="d/m/Y" datePickerType="single">
<DatePickerInput placeholder="dd/mm/yyyy" />
<DatePickerInput
placeholder="dd/mm/yyyy"
id="date-picker-2"
labelText="Locale example"
/>
</DatePicker>

```jsx
Expand All @@ -161,15 +169,23 @@ as the `locale` prop example. One is setting it as September 1st, and the other
is setting it as January 9th.

<DatePicker maxDate="09/01/2020" datePickerType="single">
<DatePickerInput placeholder="dd/mm/yyyy" />
<DatePickerInput
placeholder="dd/mm/yyyy"
id="date-picker-3"
labelText="US format"
/>
</DatePicker>
<br />
<DatePicker
maxDate="09/01/2020"
datePickerType="single"
locale="no"
dateFormat="d/m/Y">
<DatePickerInput placeholder="mm/dd/yyyy" />
<DatePickerInput
placeholder="mm/dd/yyyy"
id="date-picker-4"
labelText="European format"
/>
</DatePicker>

```jsx
Expand All @@ -191,7 +207,11 @@ is setting it as January 9th.
Works similarly to the `maxDate` prop. [See above](#datepicker-maxdate).

<DatePicker maxDate="09/01/2020" datePickerType="single" value="07/15/1988">
<DatePickerInput placeholder="dd/mm/yyyy" />
<DatePickerInput
placeholder="dd/mm/yyyy"
id="date-picker-5"
labelText="minDate example"
/>
</DatePicker>

### DatePicker `value`
Expand All @@ -200,14 +220,22 @@ By default `DatePicker` will set the current date as its value. If you'd like to
start this at a different date, you can pass in a date string or date object.

<DatePicker maxDate="09/01/2020" datePickerType="single" value="07/15/1988">
<DatePickerInput placeholder="dd/mm/yyyy" />
<DatePickerInput
placeholder="dd/mm/yyyy"
id="date-picker-6"
labelText="Value as string example"
/>
</DatePicker>
<br />
<DatePicker
maxDate="09/01/2020"
datePickerType="single"
value={new Date().setDate(-10)}>
<DatePickerInput placeholder="dd/mm/yyyy" />
<DatePickerInput
placeholder="dd/mm/yyyy"
id="date-picker-7"
labelText="Value as object example"
/>
</DatePicker>

```jsx
Expand Down