Skip to content

Commit

Permalink
change docs, remove ComponentSize refs
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceharrison1984 committed Jan 10, 2023
1 parent a2af3ac commit e448ec0
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 100 deletions.
181 changes: 88 additions & 93 deletions apps/schedulely-docs/docs/Components/Header.md
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>
);
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ComponentSize } from '@/types/ComponentSize';
import { DateTimeAdapter } from '@/types/index';
import { createDefaultAdapter } from '@/dateAdapters/date';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ComponentSize } from '@/types/ComponentSize';
import chance from 'chance';

const DEFAULT_ITERATIONS = 30;
Expand Down
1 change: 0 additions & 1 deletion packages/Schedulely/src/dateAdapters/date.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ComponentSize } from '@/types/ComponentSize';
import { DateTimeAdapter } from '@/types';

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/Schedulely/src/types/DateAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ComponentSize } from '@/types';

/**
* Common interface for porting date libraries so they can be used with Schedulely
*/
Expand Down
1 change: 0 additions & 1 deletion packages/Schedulely/src/types/SchedulelyProps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
ActionContextState,
CalendarEvent,
ComponentSize,
DateTimeAdapter,
SchedulelyComponents,
} from '@/types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ComponentSize } from '@/types';
import { JSXElementConstructor } from 'react';

/** Props used when creating a Header */
Expand Down

0 comments on commit e448ec0

Please sign in to comment.