Skip to content

Commit

Permalink
docs(SkipContent): refactor jsx examples to tsx (#2211)
Browse files Browse the repository at this point in the history
  • Loading branch information
langz authored and tujoworker committed May 31, 2023
1 parent 7778679 commit f95d453
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
Dl,
Dd,
Dt,
H2,
} from '@dnb/eufemia/src'

export const SkipContentTable = () => (
Expand Down Expand Up @@ -100,3 +101,40 @@ const LargeTableWithInteractiveElements = (props) => {
</Table.ScrollView>
)
}

export const SkipContentInfo1 = () => (
<ComponentBox hidePreview hideToolbar>
<section aria-labelledby="heading-id">
<H2 id="heading-id">Description of table</H2>

<SkipContent selector="#my-selector" text="Skip table content" />

<Table aria-labelledby="heading-id">table content</Table>
</section>

<section id="my-selector" aria-label="Submit">
<div id="submit-form" />
</section>
</ComponentBox>
)

export const SkipContentInfo2 = () => (
<ComponentBox hidePreview hideToolbar>
<section aria-labelledby="table-id">
<SkipContent selector=".my-selector">Skip table content</SkipContent>

<Table id="table-id">
<caption>Description of table</caption>
</Table>

<div className="my-selector">
<SkipContent.Return
selector=".my-selector" // same as SkipContent
text="Back to beginning of table"
/>

<div id="submit-form" />
</div>
</section>
</ComponentBox>
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ showTabs: true
---

import { Button } from '@dnb/eufemia/src'
import {
SkipContentInfo1,
SkipContentInfo2,
} from 'Docs/uilib/components/skip-content/Examples'

## Description

Expand Down Expand Up @@ -41,46 +45,13 @@ The revealing button needs a clear message to let the user easily understand the

Ensure you put a header or a section before the `SkipContent` component. It should describe the content, so the user understands the context.

- Example with a section landmark (section) and header + `SkipContent.Return`:
#### Example with a section landmark (section) and header + `SkipContent.Return`:

```jsx
<section aria-labelledby="heading-id">
<H2 id="heading-id">Description of table</H2>
<SkipContentInfo1 />

<SkipContent
selector="#my-selector"
text="Skip table content"
/>
#### Example using a section landmark (section) and table caption:

<Table aria-labelledby="heading-id" />

</section>

<section id="my-selector" aria-label="Submit">
<SubmitForm />
</section>
```

- Example using a section landmark (section) and table caption:

```jsx
<section aria-labelledby="table-id">
<SkipContent selector=".my-selector">Skip table content</SkipContent>

<Table id="table-id">
<caption>Description of table</caption>
</Table>

<div className="my-selector">
<SkipContent.Return
selector=".my-selector" // same as SkipContent
text="Back to beginning of table"
/>

<SubmitForm />
</div>
</section>
```
<SkipContentInfo2 />

### Return button

Expand Down

0 comments on commit f95d453

Please sign in to comment.