Skip to content

Commit

Permalink
docs(accordion): 📝 finish docs
Browse files Browse the repository at this point in the history
  • Loading branch information
navin-moorthy committed Jul 21, 2022
1 parent df6e312 commit e99e583
Show file tree
Hide file tree
Showing 20 changed files with 1,068 additions and 769 deletions.
33 changes: 24 additions & 9 deletions docs-templates/accordion.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Accordion

`Accordion` component expands/collapses to show more information on clicking the
trigger button. It follows the
[WAI-ARIA Accordion Pattern](https://www.w3.org/TR/wai-aria-practices-1.2/#accordion)
trigger button. It follows The
[WAI-ARIA Accordion Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/)
for
[keyboard interaction](https://www.w3.org/TR/wai-aria-practices-1.2/#keyboard-interaction)
[keyboard interaction](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/#:~:text=at%20a%20time.-,Keyboard%20Interaction,-Enter)
&
[accessibiltiy properties](https://www.w3.org/TR/wai-aria-practices-1.2/#wai-aria-roles-states-and-properties).
[accessibiltiy properties](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/#:~:text=last%20accordion%20header.-,WAI%2DARIA%20Roles%2C%20States%2C%20and%20Properties%3A,-The%20title%20of).

<!-- INJECT_TOC -->

Expand All @@ -18,17 +18,32 @@ for
link_title: Accordion
js: src/accordion/stories/templates/AccordionBasicJsx.ts
-->
<!-- CODESANDBOX
link_title: Accordion TS
tsx: src/accordion/stories/templates/AccordionBasicTsx.ts
-->

## Other Examples

<!-- CODESANDBOX
link_title: Accordion Multiple
js: src/accordion/stories/templates/AccordionMultipleJsx.ts
-->
<!-- CODESANDBOX
link_title: Accordion Multiple TS
tsx: src/accordion/stories/templates/AccordionMultipleTsx.ts
-->

<!-- CODESANDBOX
link_title: Accordion Styled
js: src/accordion/stories/templates/AccordionStyledJsx.ts
css: src/accordion/stories/templates/AccordionStyledCss.ts
-->

## Accessibility Requirements

- Each `AccordionTrigger` should be wrapped in an element with role `heading`
with proper aria-level.
<!-- CODESANDBOX
link_title: Accordion Styled TS
tsx: src/accordion/stories/templates/AccordionStyledTsx.ts
css: src/accordion/stories/templates/AccordionStyledCss.ts
-->

<!-- INJECT_COMPOSITION src/accordion -->

Expand Down
157 changes: 142 additions & 15 deletions docs/accordion.md

Large diffs are not rendered by default.

58 changes: 9 additions & 49 deletions docs/breadcrumb.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,24 @@ required aria attributes for it's links. It follows the
for its
[accessibility properties](https://www.w3.org/TR/wai-aria-practices-1.2/#wai-aria-roles-states-and-properties-2).

## Table of Contents

- [Usage](#usage)
- [Accessibility Requirement](#accessibility-requirement)
<!-- INJECT_TOC -->

## Usage

```js
import * as React from "react";

import { BreadcrumbLink, Breadcrumbs } from "@adaptui/react";

export const BreadcrumbsBasic = props => {
return (
<Breadcrumbs aria-label="Breadcrumb" className="breadcrumb">
<ol>
<li>
<BreadcrumbLink href="https://www.w3.org/TR/wai-aria-practices-1.1/">
WAI-ARIA Authoring Practices 1.1
</BreadcrumbLink>
</li>
<li>
<BreadcrumbLink href="https://www.w3.org/TR/wai-aria-practices-1.1/#aria_ex">
Design Patterns
</BreadcrumbLink>
</li>
<li>
<BreadcrumbLink
isCurrentPage
href="https://www.w3.org/TR/wai-aria-practices-1.1/#breadcrumb"
>
Breadcrumb Pattern
</BreadcrumbLink>
</li>
<li>
<BreadcrumbLink href="https://www.w3.org/TR/wai-aria-practices-1.1/examples/breadcrumb/index.html">
Breadcrumb Example
</BreadcrumbLink>
</li>
</ol>
</Breadcrumbs>
);
};
<!-- IMPORT_EXAMPLE src/breadcrumbs/stories/templates/BreadcrumbsBasicJsx.ts -->

export default BreadcrumbsBasic;
```

[![Edit CodeSandbox](https://img.shields.io/badge/Breadcrumbs-Open%20On%20CodeSandbox-%230971f1?style=for-the-badge&logo=codesandbox&labelColor=151515)](https://codesandbox.io/s/4ywvzv)
<!-- CODESANDBOX
link_title: Breadcrumbs
js: src/breadcrumbs/stories/templates/BreadcrumbsBasicJsx.ts
css: src/breadcrumbs/stories/templates/BreadcrumbsBasicCss.ts
-->

## Accessibility Requirement

- `Breadcrumbs` should have `aria-label` or `aria-labelledby` attribute.
- `BreadcrumbLink` should have `aria-current` set to `page` if the currenct page
is loaded.

## Composition

- BreadcrumbLink uses `useCommand`
- Breadcrumbs uses
<!-- INJECT_COMPOSITION src/breadcrumbs -->

<!-- INJECT_PROPS src/breadcrumbs -->
## Props
245 changes: 122 additions & 123 deletions docs/calendar.md

Large diffs are not rendered by default.

44 changes: 7 additions & 37 deletions docs/datefield.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,16 @@
[Native Input Date](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date)
for the keyboard navigation & accessibility features.

## Table of Contents

- [Usage](#usage)
- [DateField](#datefield-1)
<!-- INJECT_TOC -->

## Usage

### DateField

```js
import React from "react";

import {
DateField,
DateSegment,
useDateFieldBaseState,
useDateFieldState,
} from "@adaptui/react";

export const DateFieldBasic = props => {
const state = useDateFieldBaseState({ ...props });
const datefield = useDateFieldState({ ...props, state });

return (
<DateField state={datefield} className="datepicker__field">
{state.segments.map((segment, i) => (
<DateSegment
key={i}
segment={segment}
state={state}
className="datepicker__field--item"
>
{segment.text}
</DateSegment>
))}
</DateField>
);
};

export default DateFieldBasic;
```
<!-- IMPORT_EXAMPLE src/datefield/stories/templates/DateFieldBasicJsx.ts -->

[![Edit CodeSandbox](https://img.shields.io/badge/DateField-Open%20On%20CodeSandbox-%230971f1?style=for-the-badge&logo=codesandbox&labelColor=151515)](https://codesandbox.io/s/mvnst9)
<!-- CODESANDBOX
link_title: DateField
js: src/datefield/stories/templates/DateFieldBasicJsx.ts
css: src/datefield/stories/templates/DateFieldBasicCss.ts
-->
Loading

0 comments on commit e99e583

Please sign in to comment.