Skip to content

Commit ca7a45e

Browse files
committed
docs(:pencil:)
- Restructuring docs - Adding uncontrolled/controlled guides - Adding sorting to prop table - etc.
1 parent 312a3cc commit ca7a45e

26 files changed

Lines changed: 12247 additions & 433 deletions

docs/docs/api/checkbox.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
id: checkbox
3+
title: Checkbox API
4+
---
5+
6+
import PropsTable from '../../src/components/PropsTable';
7+
8+
## `Checkbox` API
9+
10+
<PropsTable displayName="Checkbox" />
11+
12+
## `useCheckboxState` API
13+
14+
<PropsTable displayName="useCheckboxState" />
15+
16+
### `useCheckboxState` Return
17+
18+
| Name | Type | Description |
19+
| ---------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
20+
| `state` | `string` \| `boolean` \| `any[]` | The state object of the checkbox. This can be a boolean or an array of items. |
21+
| `setState` | `React.Dispatch<React.SetStateAction<typeof state>>` | The React dispatch function from `useState` or a reference to `this.setState` |
22+
| `onChange` | `React.ChangeEventHandler<HTMLInputElement>` | The change handler to be called by the input control when a change event fires. This calls `setState` for you |

docs/docs/api/radio.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
id: radio
3+
title: Radio API
4+
---
5+
6+
import PropsTable from '../../src/components/PropsTable';
7+
8+
## `Radio` API
9+
10+
<PropsTable displayName="Radio" />
11+
12+
## `useRadioState` API
13+
14+
<PropsTable displayName="useRadioState" />
15+
16+
### `useRadioState` Return
17+
18+
| Name | Type | Description |
19+
| ---------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
20+
| `state` | `string` \| `boolean` | The state object of the radio. This can be a boolean or an array of items. |
21+
| `setState` | `React.Dispatch<React.SetStateAction<typeof state>>` | The React dispatch function from `useState` or a reference to `this.setState` |
22+
| `onChange` | `React.ChangeEventHandler<HTMLInputElement>` | The change handler to be called by the input control when a change event fires. This calls `setState` for you |

docs/docs/api/switch.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
id: switch
3+
title: Switch API
4+
---
5+
6+
import PropsTable from '../../src/components/PropsTable';
7+
8+
## `Switch` API
9+
10+
<PropsTable displayName="Switch" />

docs/docs/checkbox.mdx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
id: checkbox
3+
title: Checkbox
4+
sidebar_label: Checkbox
5+
---
6+
7+
At the heart and soul of every application is at least one checkbox. It might be a terms and conditions agreement,
8+
"Do not sell" CCPA notice, or something else; whatever it is, `pretty-checkbox-react` (PCR) has your back.
9+
10+
## Shapes, Variants, & States
11+
12+
There's no "one size fits all" for input controls like Checkbox.
13+
Thankfully, PCR allows you to represent Checkbox in various ways via the `shape` and `variant` prop
14+
for pre-bundled fun. See the [`shapes`](getting-started/shapes-size) docs for more details.
15+
16+
```jsx live
17+
<>
18+
<Checkbox>Regular</Checkbox>
19+
<Checkbox shape="curve" variant="thick">Thick Curve</Checkbox>
20+
<Checkbox shape="round" variant="fill">Fill Round</Checkbox>
21+
</>
22+
```
23+
24+
### Disabled &amp; Locked
25+
26+
Of course `disabled` is supported, but there's also a secondary state called `locked`.
27+
See the [states](getting-started/states) docs for more details.
28+
29+
```jsx live
30+
<>
31+
<Checkbox>Regular</Checkbox>
32+
<Checkbox disabled>Disabled</Checkbox>
33+
<Checkbox locked>Locked</Checkbox>
34+
</>
35+
```
36+
37+
### Scalability
38+
39+
Out of the box, PCR offers a `bigger` prop to make all input controls just a tad bit larger.
40+
For more fine-grained control check out the [size docs](getting-started/shapes-size#size).
41+
42+
```jsx live
43+
<>
44+
<Checkbox>Regular</Checkbox>
45+
<Checkbox bigger>Bigger</Checkbox>
46+
</>
47+
```
48+
49+
## Uncontrolled
50+
51+
## Controlled
52+
53+
## Indeterminate
54+
55+
Building a wickedly awesome control that needs `indeterminate`, or tri-state support?
56+
PCR has you covered for controlled and uncontrolled components.
57+

docs/docs/checkbox/checkbox.mdx

Lines changed: 0 additions & 141 deletions
This file was deleted.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
id: installation
2+
id: get-started
33
title: Get Started
4-
sidebar_label: Installation
4+
slug: /
55
---
66

7-
Pretty Checkbox React (PCR for short) is a small, a11y friendly implementation of Pretty Checkbox :star: with easy as pie usage :pie:
7+
Pretty Checkbox React (PCR for short) is a small, a11y friendly implementation of Pretty Checkbox :star: with easy as pie usage :pie:.
88

99
## Installation
1010

11-
First, make sure `react` and `react-dom` 16.9+ are installed:
11+
Awesome much? I think yes! To get PCR, first make sure `react` and `react-dom` 16.9+ are installed:
1212

1313
```sh
1414
npm i react react-dom
@@ -22,7 +22,7 @@ npm i @djthoms/pretty-checkbox pretty-checkbox-react
2222

2323
## Usage
2424

25-
Pretty Checkbox React exposes three components as [named exports](https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export) that are importable in your super groovy development environment:
25+
Pretty Checkbox React exposes three components as [named exports](https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export) that are importable in your fancy development environment:
2626

2727
- `Checkbox`
2828
- `Radio`

docs/docs/getting-started/animations.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)