Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(SkipContent): refactor jsx examples to tsx #2211

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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