-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Calendar): add stories (#3711)
* chore(Calendar): add stories * fix: texts and format * fix: flaky tests * fix: slight change to default dates
- Loading branch information
1 parent
7ec7c1a
commit 9944a6e
Showing
9 changed files
with
136 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
import { Calendar } from '@toptal/picasso' | ||
import { noop } from '@toptal/picasso/utils' | ||
|
||
const RangeExample = () => { | ||
return ( | ||
<Calendar | ||
value={[new Date('2021-07-11'), new Date('2021-07-18')]} | ||
range | ||
onChange={noop} | ||
/> | ||
) | ||
} | ||
|
||
export default RangeExample |
17 changes: 17 additions & 0 deletions
17
packages/picasso/src/Calendar/story/WithCustomDayRendering.example.tsx
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,17 @@ | ||
import React from 'react' | ||
import { Calendar, Tooltip } from '@toptal/picasso' | ||
import { noop } from '@toptal/picasso/utils' | ||
|
||
const WithCustomDayRenderingExample = () => { | ||
return ( | ||
<Calendar | ||
value={new Date('2021-07-11')} | ||
onChange={noop} | ||
renderDay={({ children }) => { | ||
return <Tooltip content='Message in tooltip'>{children}</Tooltip> | ||
}} | ||
/> | ||
) | ||
} | ||
|
||
export default WithCustomDayRenderingExample |
18 changes: 18 additions & 0 deletions
18
packages/picasso/src/Calendar/story/WithDisabledIntervals.example.tsx
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,18 @@ | ||
import React from 'react' | ||
import { Calendar } from '@toptal/picasso' | ||
import { noop } from '@toptal/picasso/utils' | ||
|
||
const WithDisabledIntervalsExample = () => { | ||
return ( | ||
<Calendar | ||
activeMonth={new Date('2021-07-05')} | ||
onChange={noop} | ||
disabledIntervals={[ | ||
{ start: new Date('2021-07-11'), end: new Date('2021-07-14') }, | ||
{ start: new Date('2021-07-28'), end: new Date('2021-07-30') }, | ||
]} | ||
/> | ||
) | ||
} | ||
|
||
export default WithDisabledIntervalsExample |
18 changes: 18 additions & 0 deletions
18
packages/picasso/src/Calendar/story/WithIndicatedIntervals.example.tsx
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,18 @@ | ||
import React from 'react' | ||
import { Calendar } from '@toptal/picasso' | ||
import { noop } from '@toptal/picasso/utils' | ||
|
||
const WithIndicatedIntervalsExample = () => { | ||
return ( | ||
<Calendar | ||
activeMonth={new Date('2021-07-05')} | ||
onChange={noop} | ||
indicatedIntervals={[ | ||
{ start: new Date('2021-07-11'), end: new Date('2021-07-14') }, | ||
{ start: new Date('2021-07-28'), end: new Date('2021-07-30') }, | ||
]} | ||
/> | ||
) | ||
} | ||
|
||
export default WithIndicatedIntervalsExample |
20 changes: 20 additions & 0 deletions
20
packages/picasso/src/Calendar/story/WithSelectableDaysLimit.example.tsx
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,20 @@ | ||
import React, { useState } from 'react' | ||
import type { DateOrDateRangeType } from '@toptal/picasso' | ||
import { Calendar } from '@toptal/picasso' | ||
|
||
const WithSelectableDaysLimitExample = () => { | ||
const [value, setValue] = useState<DateOrDateRangeType>( | ||
new Date('2021-07-09') | ||
) | ||
|
||
return ( | ||
<Calendar | ||
value={value} | ||
onChange={setValue} | ||
minDate={new Date('2021-07-08')} | ||
maxDate={new Date('2021-07-15')} | ||
/> | ||
) | ||
} | ||
|
||
export default WithSelectableDaysLimitExample |
9 changes: 9 additions & 0 deletions
9
packages/picasso/src/Calendar/story/WithTwoMonths.example.tsx
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,9 @@ | ||
import React from 'react' | ||
import { Calendar } from '@toptal/picasso' | ||
import { noop } from '@toptal/picasso/utils' | ||
|
||
const WithTwoMonthsExample = () => { | ||
return <Calendar onChange={noop} range numberOfMonths={2} /> | ||
} | ||
|
||
export default WithTwoMonthsExample |
9 changes: 9 additions & 0 deletions
9
packages/picasso/src/Calendar/story/WithWeekStartsOnSunday.example.tsx
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,9 @@ | ||
import React from 'react' | ||
import { Calendar } from '@toptal/picasso' | ||
import { noop } from '@toptal/picasso/utils' | ||
|
||
const WithWeekStartsOnSundayExample = () => { | ||
return <Calendar onChange={noop} weekStartsOn={0} /> | ||
} | ||
|
||
export default WithWeekStartsOnSundayExample |
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