-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change docs, remove ComponentSize refs
- Loading branch information
1 parent
a2af3ac
commit e448ec0
Showing
7 changed files
with
88 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,88 @@ | ||
--- | ||
title: Header Component | ||
--- | ||
|
||
## Description | ||
|
||
The `HeaderComponent` defines how the large banner at the top of the calendar appears. It can include as many or | ||
as few controls as you want. | ||
|
||
## Component Props | ||
|
||
```tsx | ||
export interface HeaderProps { | ||
month: string; | ||
year: number; | ||
isCurrentMonth: boolean; | ||
onNextMonth: () => void; | ||
onNextYear: () => void; | ||
onPrevMonth: () => void; | ||
onPrevYear: () => void; | ||
} | ||
``` | ||
|
||
| Property | Type | Description | | ||
| -------------- | --------------- | ------------------------------------------------------------------------------------ | | ||
| month | `string` | The current month the calendar is displaying | | ||
| year | `number` | The current year the calendar is displaying | | ||
| isCurrentMonth | `boolean` | True if the selected month is the same as the current month | | ||
| onNextMonth | `() => void` | Calling this functions moves to the next month | | ||
| onNextYear | `() => void` | Calling this functions moves to the same month of the next year | | ||
| onPrevMonth | `() => void` | Calling this functions moves to the previous month | | ||
| onPrevYear | `() => void` | Calling this functions moves to the same month of the previous year | | ||
| componentSize | `ComponentSize` | Enum value that indicates the current size of the calendar (used for element sizing) | | ||
|
||
## Example (DefaultHeader) | ||
|
||
```tsx live noInline | ||
// This demo is an example of what a custom component might look like if you wanted to override the default. | ||
// If you are using the default components, you don't need to worry about this. | ||
|
||
const DefaultHeader = ({ | ||
month, | ||
year, | ||
onNextMonth, | ||
onNextYear, | ||
onPrevMonth, | ||
onPrevYear, | ||
isCurrentMonth, | ||
componentSize, | ||
}) => ( | ||
<div className="header-layout"> | ||
<button | ||
className="header-button" | ||
title="Previous Month" | ||
onClick={onPrevMonth} | ||
> | ||
<strong>{'‹'}</strong> | ||
</button> | ||
<button | ||
className="header-button" | ||
title="Previous Year" | ||
onClick={onPrevYear} | ||
> | ||
<strong>{'«'}</strong> | ||
</button> | ||
|
||
<div className="header-banner"> | ||
<span | ||
className="header-text" | ||
style={{ fontSize: componentSize === 'large' ? '1.5em' : '1.1em' }} | ||
> | ||
{month} - {year} | ||
</span> | ||
{isCurrentMonth && ( | ||
<div className="current-month-indicator" title="Current Month" /> | ||
)} | ||
</div> | ||
|
||
<button className="header-button" title="Next Year" onClick={onNextYear}> | ||
<strong>{'»'}</strong> | ||
</button> | ||
<button className="header-button" title="Next Month" onClick={onNextMonth}> | ||
<strong>{'›'}</strong> | ||
</button> | ||
</div> | ||
); | ||
|
||
render( | ||
<div className="schedulely"> | ||
<DefaultHeader month="December" year="2022" componentSize={'large'} /> | ||
</div> | ||
); | ||
``` | ||
--- | ||
title: Header Component | ||
--- | ||
|
||
## Description | ||
|
||
The `HeaderComponent` defines how the large banner at the top of the calendar appears. It can include as many or | ||
as few controls as you want. | ||
|
||
## Component Props | ||
|
||
```tsx | ||
export interface HeaderProps { | ||
month: string; | ||
year: number; | ||
isCurrentMonth: boolean; | ||
onNextMonth: () => void; | ||
onNextYear: () => void; | ||
onPrevMonth: () => void; | ||
onPrevYear: () => void; | ||
} | ||
``` | ||
|
||
| Property | Type | Description | | ||
| -------------- | ------------ | ------------------------------------------------------------------- | | ||
| month | `string` | The current month the calendar is displaying | | ||
| year | `number` | The current year the calendar is displaying | | ||
| isCurrentMonth | `boolean` | True if the selected month is the same as the current month | | ||
| onNextMonth | `() => void` | Calling this functions moves to the next month | | ||
| onNextYear | `() => void` | Calling this functions moves to the same month of the next year | | ||
| onPrevMonth | `() => void` | Calling this functions moves to the previous month | | ||
| onPrevYear | `() => void` | Calling this functions moves to the same month of the previous year | | ||
|
||
## Example (DefaultHeader) | ||
|
||
```tsx live noInline | ||
// This demo is an example of what a custom component might look like if you wanted to override the default. | ||
// If you are using the default components, you don't need to worry about this. | ||
|
||
const DefaultHeader = ({ | ||
month, | ||
year, | ||
onNextMonth, | ||
onNextYear, | ||
onPrevMonth, | ||
onPrevYear, | ||
isCurrentMonth, | ||
}) => ( | ||
<div className="header-layout"> | ||
<button | ||
className="header-button" | ||
title="Previous Month" | ||
onClick={onPrevMonth} | ||
> | ||
<strong>{'‹'}</strong> | ||
</button> | ||
<button | ||
className="header-button" | ||
title="Previous Year" | ||
onClick={onPrevYear} | ||
> | ||
<strong>{'«'}</strong> | ||
</button> | ||
|
||
<div className="header-banner"> | ||
<span className="header-text"> | ||
{month} - {year} | ||
</span> | ||
{isCurrentMonth && ( | ||
<div className="current-month-indicator" title="Current Month" /> | ||
)} | ||
</div> | ||
|
||
<button className="header-button" title="Next Year" onClick={onNextYear}> | ||
<strong>{'»'}</strong> | ||
</button> | ||
<button className="header-button" title="Next Month" onClick={onNextMonth}> | ||
<strong>{'›'}</strong> | ||
</button> | ||
</div> | ||
); | ||
|
||
render( | ||
<div className="schedulely"> | ||
<DefaultHeader month="December" year="2022" /> | ||
</div> | ||
); | ||
``` |
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
1 change: 0 additions & 1 deletion
1
packages/Schedulely/__tests__/testHelpers/dateAdapter.testHelper.ts
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import { ComponentSize } from '@/types/ComponentSize'; | ||
import { DateTimeAdapter } from '@/types'; | ||
|
||
/** | ||
|
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