Skip to content

Commit

Permalink
notice: support for brand colors #251
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed May 23, 2022
1 parent 5ef497a commit d7bc402
Show file tree
Hide file tree
Showing 4 changed files with 247 additions and 97 deletions.
299 changes: 207 additions & 92 deletions exampleSite/content/shortcodes/notice.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,59 @@ description = "Disclaimers to help you structure your page"
title = "Notice"
+++

The notice shortcode shows four types of disclaimers to help you structure your page.
The notice shortcode shows various types of disclaimers with adjustable title and icon to help you structure your page.

{{% notice style="primary" title="There may be pirates" icon="skull-crossbones" %}}
It is all about the boxes.
{{% /notice %}}

## Usage

While the examples are using named parameter you are free to use positional aswell.

{{< tabs >}}
{{% tab name="named" %}}

````go
{{%/* notice style="primary" title="There may be pirates" icon="skull-crossbones" */%}}
It is all about the boxes.
{{%/* /notice */%}}
````

{{% /tab %}}
{{% tab name="positional" %}}

````go
{{%/* notice ( note | info | tip | warning ) [ <string> [ <string> ] ] */%}}
Some markup
{{%/* notice primary "There may be pirates" "skull-crossbones" */%}}
It is all about the boxes.
{{%/* /notice */%}}
````

The first parameter is required and indicates the type of notice.
{{% /tab %}}
{{< /tabs >}}

The second parameter is optional. If provided, it will be used as the title of the notice. If not provided, then the type of notice will be used as the title. For example, the title of a warning notice will be "Warning".
### Parameter

| Name | Position | Optional | Default | Notes |
|:----------|:---------|:----------|:----------|:------------|
| **style** | 1 | yes | `default` | The color scheme used to highlight the box content.<br/><br/>- by severity: `info`, `note`, `tip`, `warning`<br/>- by brand color: `primary`, `secondary`<br/>- by color: `blue`, `green`, `grey`, `orange`, `red`<br/>- by special color: `default`, `transparent` |
| **title** | 2 | yes | see notes | Arbitray text for the box title. Depending on the **style** there may be a default title. Any given value will overwrite the default.<br/><br/>- for severity styles: the matching title for the severity<br/>- for all other colors: no title<br/><br/>If you want no title for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |
| **icon** | 3 | yes | see notes | [Font Awesome icon name]({{%relref "cont/icons#finding-an-icon" %}}) set to the left of the title. Depending on the **style** there may be a default icon. Any given value will overwrite the default.<br/><br/>- for severity styles: a nice matching icon for the severity<br/>- for all other colors: no icon<br/><br/>If you want no icon for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |

The third parameter is optional. If provided, it will set the icon of near the title. For the standard types of notices, this is automatically determined but can be overridden with this parameter. If you want no icon at all, you have to set this parameter to `" "` (a non empty string filled with spaces).
## Examples

### Note
### By Severity

{{% notice note %}}
A **notice** disclaimer
#### Info with markup

{{% notice style="info" %}}
An **information** disclaimer

You can add standard markdown syntax:

- multiple paragraphs
- bullet point lists
- _emphasized_, **bold** and even ***bold emphasized*** text
- _emphasized_, **bold** and even **_bold emphasized_** text
- [links](https://example.com)
- etc.

Expand All @@ -41,9 +67,10 @@ You can add standard markdown syntax:
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice note */%}}
A **notice** disclaimer
{{%/* notice style="info" */%}}
An **information** disclaimer

You can add standard markdown syntax:

Expand All @@ -60,146 +87,234 @@ You can add standard markdown syntax:
> the possiblities are endless (almost - including other shortcodes may or may not work)
{{%/* /notice */%}}
````

{{% /expand %}}

### Info
#### Note

{{% notice info %}}
An **information** disclaimer
{{% notice style="note" %}}
A **notice** disclaimer
{{% /notice %}}

You can add standard markdown syntax:
{{% expand "Show markup" %}}

- multiple paragraphs
- bullet point lists
- _emphasized_, **bold** and even ***bold emphasized*** text
- [links](https://example.com)
- etc.
````go
{{%/* notice style="note" */%}}
A **notice** disclaimer
{{%/* /notice */%}}
````

```plaintext
...and even source code
```
{{% /expand %}}

> the possiblities are endless (almost - including other shortcodes may or may not work)
#### Tip

{{% notice style="tip" %}}
A **tip** disclaimer
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice info */%}}
An **information** disclaimer
{{%/* notice style="tip" */%}}
A **tip** disclaimer
````

You can add standard markdown syntax:
{{% /expand %}}

- multiple paragraphs
- bullet point lists
- _emphasized_, **bold** and even ***bold emphasized*** text
- [links](https://example.com)
- etc.
#### Warning

```plaintext
...and even source code
```
{{% notice style="warning" %}}
A **warning** disclaimer
{{% /notice %}}

> the possiblities are endless (almost - including other shortcodes may or may not work)
{{% expand "Show markup" %}}

````go
{{%/* notice style="warning" */%}}
A **warning** disclaimer
{{%/* /notice */%}}
````

{{% /expand %}}

### Tip
#### Warning with non-default title and icon

{{% notice tip %}}
A **tip** disclaimer
{{% notice style="warning" title="Here are dragons" icon="dragon" %}}
A **warning** disclaimer
{{% /notice %}}

You can add standard markdown syntax:
{{% expand "Show markup" %}}

- multiple paragraphs
- bullet point lists
- _emphasized_, **bold** and even ***bold emphasized*** text
- [links](https://example.com)
- etc.
````go
{{%/* notice style="warning" title="Here are dragons" icon="dragon" */%}}
A **warning** disclaimer
{{%/* /notice */%}}
````

```plaintext
...and even source code
```
{{% /expand %}}

> the possiblities are endless (almost - including other shortcodes may or may not work)
#### Warning without a title and icon

{{% notice style="warning" title=" " icon=" " %}}
A **warning** disclaimer
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice tip */%}}
A **tip** disclaimer
{{%/* notice style="warning" title=" " icon=" " */%}}
A **warning** disclaimer
{{%/* /notice */%}}
````

You can add standard markdown syntax:
{{% /expand %}}

- multiple paragraphs
- bullet point lists
- _emphasized_, **bold** and even ***bold emphasized*** text
- [links](https://example.com)
- etc.
### By Brand Colors

```plaintext
...and even source code
```
#### Primary with title only

> the possiblities are endless (almost - including other shortcodes may or may not work)
{{% notice style="primary" title="Primary" %}}
A **primary** disclaimer
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice style="primary" title="Primary" */%}}
A **primary** disclaimer
{{%/* /notice */%}}
````

{{% /expand %}}

### Warning
#### Secondary with icon only

{{% notice warning %}}
A **warning** disclaimer
{{% notice style="secondary" icon="stopwatch" %}}
A **secondary** disclaimer
{{% /notice %}}

You can add standard markdown syntax:
{{% expand "Show markup" %}}

- multiple paragraphs
- bullet point lists
- _emphasized_, **bold** and even ***bold emphasized*** text
- [links](https://example.com)
- etc.
````go
{{%/* notice style="secondary" icon="stopwatch" */%}}
A **secondary** disclaimer
{{%/* /notice */%}}
````

```plaintext
...and even source code
```
{{% /expand %}}

> the possiblities are endless (almost - including other shortcodes may or may not work)
### By Color

#### Blue without a title and icon

{{% notice style="blue" %}}
A **blue** disclaimer
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice warning */%}}
A **warning** disclaimer
{{%/* notice style="blue" */%}}
A **blue** disclaimer
{{%/* /notice */%}}
````

You can add standard markdown syntax:
{{% /expand %}}

- multiple paragraphs
- bullet point lists
- _emphasized_, **bold** and even ***bold emphasized*** text
- [links](https://example.com)
- etc.
#### Green with title only

```plaintext
...and even source code
```
{{% notice style="green" title="Green" %}}
A **green** disclaimer
{{% /notice %}}

> the possiblities are endless (almost - including other shortcodes may or may not work)
{{% expand "Show markup" %}}

````go
{{%/* notice style="green" title="Green" */%}}
A **green** disclaimer
{{%/* /notice */%}}
````

{{% /expand %}}

#### Grey with icon only

{{% notice style="grey" icon="bug" %}}
A **grey** disclaimer
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice style="grey" icon="bug" */%}}
A **grey** disclaimer
{{%/* /notice */%}}
````

{{% /expand %}}

### Notice with default color, custom title and icon
#### Orange with title and icon

You can customize the title of the notice by passing it as a second parameter.
{{% notice style="orange" title="Orange" icon="bug" %}}
A **orange** disclaimer
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice style="orange" title="Orange" icon="bug" */%}}
A **orange** disclaimer
{{%/* /notice */%}}
````

{{% /expand %}}

#### Red

{{% notice style="red" %}}
A **red** disclaimer
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice style="red" */%}}
A **red** disclaimer
{{%/* /notice */%}}
````

{{% /expand %}}

### By Special Color

#### Default with title and icon

{{% notice default "Pay Attention to this Note!" "skull-crossbones" %}}
The title is now the parameter that was provided.
Some serious information.
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice default "Pay Attention to this Note!" "skull-crossbones" */%}}
The title is now the parameter that was provided.
{{%/* notice style="default" title"Pay Attention to this Note!" icon="skull-crossbones" */%}}
Some serious information.
{{%/* /notice */%}}
````

{{% /expand %}}

#### Transparent with title and icon

{{% notice style="transparent" title="Pay Attention to this Note!" icon="skull-crossbones" %}}
Some serious information.
{{% /notice %}}

{{% expand "Show markup" %}}

````go
{{%/* notice style="transparent" title"Pay Attention to this Note!" icon="skull-crossbones" */%}}
Some serious information.
{{%/* /notice */%}}
````

{{% /expand %}}
Loading

0 comments on commit d7bc402

Please sign in to comment.