Merge pull request #11577 from opf/additional-docs-for-storybook
Adding docs for more components and patterns on Storybookpull/11727/head
commit
4258f118a6
@ -0,0 +1,26 @@ |
||||
import { Meta, Story, Canvas } from '@storybook/addon-docs'; |
||||
|
||||
<Meta title="Components/Dropdown button" /> |
||||
|
||||
# Dropdown button |
||||
|
||||
> Example: Filter button with a badge value of 3. |
||||
|
||||
## Description |
||||
|
||||
The dropdown button is a special type of button with a permanent down arrow on the right edge (suggesting further actions) and an optional badge. |
||||
|
||||
## Behaviour |
||||
|
||||
Clicking on a dropdown button generally opens the dropdown menu, or a drop modal. When the menu or modal is open, clicking on the button again closes it. |
||||
|
||||
> Example: A more button that opens a dropdown menu |
||||
|
||||
In some (rarer) cases, it can open a panel. An example of this is the Filter button. |
||||
|
||||
## Options |
||||
|
||||
The badge is optional and can hold a number from 0 to 99. After 99, the number simply reads "99+". |
||||
|
||||
|
||||
|
@ -0,0 +1,35 @@ |
||||
import { Meta, Story, Canvas } from '@storybook/addon-docs'; |
||||
|
||||
<Meta title="Patterns/Dropdown menu" /> |
||||
|
||||
# Dropdown menu |
||||
|
||||
> Example: A dropdown menu with four items |
||||
|
||||
The dropdown menu is a contextual menu triggered by clicking on a dropdown button. It provides options to the use. |
||||
|
||||
## Structure and Options |
||||
|
||||
The dropdown menu consists of a list of items, generally *menu rows* and an optional title. |
||||
|
||||
The title is not interactive. It serves to provide additional context, if necessary. |
||||
|
||||
A menu item is interactive and generally represents an action. The menu item can optionally have an icon on the left side. |
||||
|
||||
> Example of an existing more menu that has icons next to each menu row |
||||
|
||||
|
||||
## States |
||||
|
||||
Each menu item has three states: regular, hover and clicked. |
||||
|
||||
## Margins and Spacing |
||||
|
||||
Each item has a height of 1.5 rem. There is a 0.25 rem spacing between the optional icon and the label, and a 0.5 rem rem spacing to the left and right. |
||||
|
||||
The width is determined by the longest object, or can be defined manually. If defined manually, items that are very long and exceed this length are truncated. |
||||
|
||||
> Eg: a menu item that's very long and truncated |
||||
|
||||
|
||||
|
@ -0,0 +1,50 @@ |
||||
import { Meta, Story, Canvas } from '@storybook/addon-docs'; |
||||
import { moduleMetadata } from '@storybook/angular'; |
||||
|
||||
# Section Headers |
||||
|
||||
> Example: Section header example |
||||
|
||||
The section header is used to separate different sections of a page or a view, or different grouping of similar functionality. |
||||
|
||||
In the Files tab for example, the section header separates the Attachments section and the the different file storages that may be available to a work package. |
||||
|
||||
## Structure and Options |
||||
|
||||
Section headers are at their most basic form a label (in all-caps) with a line underneath. |
||||
|
||||
> Example of a basic section header |
||||
|
||||
However, they can be extended with a few additional features: |
||||
|
||||
**Left icon** |
||||
This icon can be added to provide context. In a files list, for example, the left icon is used to indicate to which storage provider (for example, Nextcloud) that file storage is linked. |
||||
|
||||
In some parts of the application, this icon is also used to indicate open/closed state when the section header functions as an expandable/collapsible section (see *Behaviour*). |
||||
|
||||
*Note: Since this element is always all-caps, the baseline of the font requires the icon to be raised by a few pixels. See* Margins and Spacing *for more details.* |
||||
|
||||
**Right icon** |
||||
The icon can be placed to the right of the text too, if required. It can optionally also be used as a link (in icon-only mode). This should nevertheless be used sparingly. |
||||
|
||||
**Action** |
||||
This is usually a button on the far edge (by default the right edge) of the component, but can also be a link. This is used to provide additional contextual action related to that whole section (to access the home directory in Nextcloud in a new tab, for example). |
||||
|
||||
> Example of a section header with a left icon and an action (like a Nextcloud file storage) |
||||
|
||||
**Right position** |
||||
The entire structure can be inverted, with the action buton on the left and the title and icons on the right. This should ideally never be used, but exists because such a format already exists in some places. Use sparingly. |
||||
|
||||
## Behaviour |
||||
|
||||
The section header behaves either as a regular header (static) or as an expandable/collapsible section, where clicking on the entire section header will expand and collapse the content underneath. |
||||
|
||||
> Example: "Group by" expandable/collapsible section, like a cost report page |
||||
|
||||
## Margins and Spacing |
||||
|
||||
The headers have an 0.5 rem top and bottom margin. |
||||
|
||||
Because the label is all-caps, the baseline of the font is (visually) slightly higher than it otherwise would have been with mixed case. If the optional icons are used, the CSS of this component automatically pushed them up by a few pixels for better alignment. |
||||
|
||||
|
@ -0,0 +1,51 @@ |
||||
import { Meta, Story, Canvas } from '@storybook/addon-docs'; |
||||
|
||||
<Meta title="Components/Toast" /> |
||||
|
||||
# Toast |
||||
|
||||
> Example: A success toast |
||||
|
||||
Toasts are small generally one-line messages that appear to inform the user of the result of an action, or an update to the current view. |
||||
|
||||
## Structure and Options |
||||
|
||||
The toast consists of: |
||||
|
||||
- An optional icon |
||||
- A text |
||||
- A close button |
||||
|
||||
There are four types of toasts, each with a specific icon and colour associated with it: |
||||
|
||||
An **Information** toast is blue (background: Feedback/Info/Light, stroke: Feedback/Info/Dark) and provides the user with helpful information about the current view. |
||||
|
||||
> Eg: a blue notification toast (as it exists today) |
||||
|
||||
A **Success** toast is green (background: Feedback/Success/Light, stroke: Feedback/Success/Dark)and indicates to the user that an action has been successfully carried out. |
||||
|
||||
> Eg: a green success toast (as it exists today) |
||||
|
||||
A **Warning** toast is orange (background: Feedback/Warning/Light, stroke: Feedback/Warning/Dark) and indicates that there are potential risks or possibility of error. |
||||
|
||||
> Eg: an orange toast (is this used somewhere?) |
||||
|
||||
An **Error** toast is red (background: Feedback/Error/Light, stroke: Feedback/Error/Dark) and indicates that something did not not go as expected, and that there is a problem. |
||||
|
||||
> Eg: a red toast (as it exists today, when moving an WP in GANTT view is not possible) |
||||
|
||||
## Behaviour |
||||
|
||||
The toast appears either as result of user action (a work package attribute is modified, for example) or a background action (there are new notifications). |
||||
|
||||
The text is generally merely informational, although there might sometimes be a link with an approproate action. |
||||
|
||||
> Eg. Blue notification toast with "Load new notifications" link. |
||||
|
||||
Toasts generally disappear automatically; they must be manually closed by the user. The only exception is the Success toast, which _can_ disappear automatically, if the user has enabled this in their account settings. |
||||
|
||||
Ideally, only one toast should be visible at any time. Hoever, there are circumstances where multiple toasts might be generated and visible to the user; in this case, the toasts must "pile" vertically with a 1 rem (?) spacing between them. |
||||
|
||||
## Margins and Spacing |
||||
|
||||
The toast has a height of 2.5 rem, with a 0.5 rem padding on all sides, and a 0.5 rem spacing between the icon, text and the close button. |
Loading…
Reference in new issue