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

chore (refs T33323): add storybook documentation to DpTabs. #344

Merged
merged 13 commits into from
Jul 4, 2023
Merged
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Since v0.0.10, this Changelog is formatted according to the [Common Changelog][c

### Added

- ([#344](https://github.com/demos-europe/demosplan-ui/pull/344)) docs: add documentation for DpTabs ([@@ahmad-demos](https://github.com/@ahmad-demos))
ahmad-demos marked this conversation as resolved.
Show resolved Hide resolved

### Added
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An "Added" section already exists!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 6fb4106


- ([#333](https://github.com/demos-europe/demosplan-ui/pull/333)) Add "rounded" prop to DpButton, add "arrow-up" and "arrow-down" icons to DpIcon ([@spiess-demos](https://github.com/spiess-demos))

## v0.1.7 - 2023-06-27
Expand Down
63 changes: 63 additions & 0 deletions src/components/DpTabs/DpTabs.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { Meta } from '@storybook/addon-docs'
import DpTabs from './DpTabs'

<Meta
title="Components/Tabs"
component={DpTabs} />

# DpTabs

DpTabs is a wrapper for DpTab component through `<slot />`.

DpTabs component is a simple user interface (tabs UI) for organizing related content and occupying a compact space.

The DpTab components are aligned horizontally, and each tab is associated with its header.

Components DpTabs and DpTab contain `<slot />`.
ahmad-demos marked this conversation as resolved.
Show resolved Hide resolved

## Default usage

```html
<dp-tabs
tab-size="medium"
:active-id="activeTabId"
use-url-fragment
@change="setActiveTabId"> // call a method
spiess-demos marked this conversation as resolved.
Show resolved Hide resolved
<dp-tab
id="id"
ahmad-demos marked this conversation as resolved.
Show resolved Hide resolved
:label="Translator.trans('tab.name')">
ahmad-demos marked this conversation as resolved.
Show resolved Hide resolved
<slot>
<component-name />
ahmad-demos marked this conversation as resolved.
Show resolved Hide resolved
</slot>
</dp-tab>
<dp-tab
id="id"
ahmad-demos marked this conversation as resolved.
Show resolved Hide resolved
:label="Translator.trans('tab.name')">
ahmad-demos marked this conversation as resolved.
Show resolved Hide resolved
<slot>
<component-name />
ahmad-demos marked this conversation as resolved.
Show resolved Hide resolved
</slot>
</dp-tab>
</dp-tabs>
```

## DpTabs Props:

```
- activeId: is a String type, belongs to data.

- tabSize: `medium` or `large`, default is `large`

- useUrlFragment: Active tab state may be persisted via an Url fragment.
Also, ab clicks are pushed to the browser history to enable state change when browser navigation is used.
```

## DpTab Props:

```
- id: Tab ID.

- label: The label is passed to the DpTab child component, but then it is used in the parent component DpTabs.

- suffix: A html string may be passed here which is appended to the tab label.
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vue component props are typically "auto-documented" by storybook using vue-docgen-api and vue-docgen-loader. At the moment the Storybook docs integraton is broken so that the props are not showing up as expected, however there is no need to document them by hand. Rather we could fill in the blanks by adding docblocks directly above the props themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 59b2c5b