-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix #date-picker where inactive days got styled wrong, if the da…
…te was todays date
- Loading branch information
1 parent
5ba394a
commit d537dd9
Showing
4 changed files
with
114 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/** | ||
* dnb-ui-lib Component Story | ||
* | ||
*/ | ||
|
||
import React, { useState } from 'react' | ||
import { Wrapper, Box } from '../helpers' | ||
// import styled from '@emotion/styled' | ||
|
||
import { DatePicker } from '../../src/components' | ||
|
||
export default [ | ||
'DatePicker', | ||
() => ( | ||
<Wrapper> | ||
<Box> | ||
<CustomDate /> | ||
</Box> | ||
<Box> | ||
<DatePicker | ||
label="Range DatePicker:" | ||
// start_date={new Date()} | ||
// start_date="2019-01-15" | ||
start_date="1981-01-15" | ||
end_date="2019-06-15" | ||
range={true} | ||
opened={false} | ||
show_input={true} | ||
on_change={props => { | ||
console.log('on_change', props) | ||
}} | ||
on_submit={props => { | ||
console.log('on_submit', props) | ||
}} | ||
on_cancel={props => { | ||
console.log('on_cancel', props) | ||
}} | ||
/> | ||
</Box> | ||
<Box> | ||
<DatePicker | ||
label="Range DatePicker:" | ||
// start_date="2019-05-01" | ||
// end_date="2019-06-17" | ||
// min_date="2019-05-02" | ||
// max_date="2019-06-15" | ||
range={true} | ||
opened={false} | ||
show_input={true} | ||
on_change={props => { | ||
console.log('on_change', props) | ||
}} | ||
on_submit={props => { | ||
console.log('on_submit', props) | ||
}} | ||
on_cancel={props => { | ||
console.log('on_cancel', props) | ||
}} | ||
/> | ||
</Box> | ||
<Box> | ||
<DatePicker | ||
label="Defualt DatePicker with Input:" | ||
date="2019-05-05" | ||
show_input={true} | ||
// show_submit_button={true} | ||
show_cancel_button={true} | ||
on_change={props => { | ||
console.log('on_change', props) | ||
}} | ||
/> | ||
</Box> | ||
<Box> | ||
<DatePicker | ||
label="Hidden Nav:" | ||
date="2019-05-05" | ||
hide_navigation={true} | ||
hide_days={true} | ||
/> | ||
</Box> | ||
<Box> | ||
<DatePicker | ||
label="Show month only:" | ||
date="2019-02-05" | ||
// hide_navigation_buttons={true} | ||
only_month={true} | ||
/> | ||
</Box> | ||
</Wrapper> | ||
) | ||
] | ||
|
||
const CustomDate = () => { | ||
const [date, setDate] = useState('2019-02-15') | ||
console.log('date', date) | ||
return ( | ||
<DatePicker | ||
label="Defualt DatePicker:" | ||
date={date} | ||
return_format="YYYY-MM-DD" | ||
on_change={({ date }) => { | ||
console.log('on_change', date) | ||
setDate(date) | ||
}} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters