Skip to content

Commit

Permalink
Docs(web-twig): Documentation for Header component (refs #DS-161)
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Jul 30, 2022
1 parent c366ae4 commit 37f83d3
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/web-twig/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- There should always be "Unreleased" section at the beginning. -->
## Unreleased
- Add main props `data-*` and `id` into `Button` and `ButtonLink` components
- Introduce `Header`, `Navbar`, `NavbarActions`, `NavbarClose`, `NavbarToggle`, `Nav `, `NavItem`, `NavLink `components

## 1.5.0 - 2022-04-04
- [BC] Use is prefix for boolean props
Expand Down
168 changes: 168 additions & 0 deletions packages/web-twig/docs/Header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Stack

This is Twig implementation of the [Header] component.

## Examples
pure implementation:
```twig
{% embed "@spirit/header.twig" %}
{% block content %}
<a href="/">
<img
src="https://www.example.com/logo.png"
width="65"
height="24"
alt="Spirit"
/>
</a>
{% endblock %}
{% endembed %}
```

With Html syntax lexer (enabled by default):
```twig
<Header>
<a href="/">
<img
src="https://www.example.com/logo.png"
width="65"
height="24"
alt="Spirit"
/>
</a>
</Header>
<Header isSimple isInverted>
<a href="/">
<img
src="https://www.example.com/logo.png"
width="65"
height="24"
alt="Spirit"
/>
</a>
</Header>
```

### Full Header example

```twig
<Header isInverted>
<a href="/">
<img
src="https://www.example.com/logo.png"
width="65"
height="24"
alt="Spirit"
/>
</a>
<NavbarToggle />
<Navbar variant="bar">
<NavbarClose />
<NavbarActions color="primary">
<Nav>
<NavItem>
<NavLink href="/" isCurrent>Nabídky práce</NavLink>
</NavItem>
<NavItem>
<NavLink href="/">Brigády</NavLink>
</NavItem>
<NavItem>
<NavLink href="/">Inspirace</NavLink>
</NavItem>
<NavItem>
<NavLink href="/">Historie odpovědí</NavLink>
</NavItem>
<NavItem>
<NavLink href="/">Zaměstnavatelé</NavLink>
</NavItem>
</Nav>
</NavbarActions>
<NavbarActions color="secondary">
<ButtonLink color="primary" href="/">Přihlásit</ButtonLink>
<ButtonLink color="inverted" href="/">Vstup pro firmy</ButtonLink>
</NavbarActions>
</Navbar>
</Header>
```

## Header components

The Header itself consists of many components which cannot be used independently.

### Header

#### Available props

| Name | Type | Description |
|---------------|-------------------------------|--------------------------------------|
| `isSimple` | boolean | Whether it is without components |
| `isInverted` | boolean | Whether it has inverted colors |
| `class` | string | Additional class name |

### Navbar

#### Available props

| Name | Type | Description |
|---------------|-------------------------------|--------------------------------------|
| `class` | string | Additional class name |

### NavbarActions

#### Available props

| Name | Type | Description |
|---------------|------------------------------------|--------------------------------------|
| `color` | `primary`, `secondary`, `inverted` | Colors |
| `class` | string | Additional class name |

### NavbarClose

#### Available props

| Name | Type | Description |
|----------------|-------------------------------|--------------------------------------------|
| `label` | string | Label of the close button |
| `ariaControls` | string | Target element which is controled by close |
| `class` | string | Additional class name |

### NavbarToggle

#### Available props

| Name | Type | Description |
|----------------|------------------------------------|--------------------------------------------|
| `label` | string | Label of the toggle button |
| `ariaControls` | string | Target element which is controled by close |
| `color` | `primary`, `secondary`, `inverted` | Colors |
| `class` | string | Additional class name |

### Nav

#### Available props

| Name | Type | Description |
|---------------|-------------------------------|--------------------------------------|
| `class` | string | Additional class name |

### NavItem

#### Available props

| Name | Type | Description |
|---------------|-------------------------------|--------------------------------------|
| `class` | string | Additional class name |

### NavItem

#### Available props

| Name | Type | Description |
|---------------|---------------------------|---------------------------------------------|
| href | `string` | # | anchor href link |
| target | `string` | __self | anchor target |
| ariaLabel | `string` | undefined | Accessible Rich Internet Applications label |
| onClick | `string` | undefined | execute a JavaScript when a link is clicked |
| `class` | string | Additional class name |

[Header]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web/src/components/Header

0 comments on commit 37f83d3

Please sign in to comment.