-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(CalendarMonth): provided explicit guidance for labeling an inli…
…ne calendar month (#8375) * chore(CalendarMonth): provided explicit guidance for labeling an inline calendar month * update per PR comments * move inline accommodations into an inlineProps prop * fix typo and address PR comments * fix test failures * fix tests and snapshots
- Loading branch information
1 parent
2f30f0c
commit 3c593cc
Showing
5 changed files
with
69 additions
and
8 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
21 changes: 19 additions & 2 deletions
21
packages/react-core/src/components/CalendarMonth/examples/CalendarMonthDateRange.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 |
---|---|---|
@@ -1,10 +1,27 @@ | ||
import React from 'react'; | ||
import { CalendarMonth } from '@patternfly/react-core'; | ||
import { CalendarMonth, Title, CalendarMonthInlineProps } from '@patternfly/react-core'; | ||
|
||
export const CalendarMonthDateRange: React.FunctionComponent = () => { | ||
const startDate = new Date(2020, 10, 11); | ||
const endDate = new Date(2020, 10, 24); | ||
const disablePreStartDates = (date: Date) => date >= startDate; | ||
|
||
return <CalendarMonth validators={[disablePreStartDates]} date={endDate} rangeStart={startDate} />; | ||
const inlineProps: CalendarMonthInlineProps = { | ||
component: 'article', | ||
title: ( | ||
<Title id="display-range" headingLevel="h4"> | ||
Calendar month displaying a range | ||
</Title> | ||
), | ||
ariaLabelledby: 'display-range' | ||
}; | ||
|
||
return ( | ||
<CalendarMonth | ||
validators={[disablePreStartDates]} | ||
date={endDate} | ||
rangeStart={startDate} | ||
inlineProps={inlineProps} | ||
/> | ||
); | ||
}; |
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