Skip to content

Commit

Permalink
v0.12.1: color buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtOfCode- committed Jun 6, 2021
1 parent fd08579 commit 8a991ae
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/codidact.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/codidact.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/common/common.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/common/common.css.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions docs/components/buttons/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ <h5 id="example-danger">Example</h5><div class="d-example"><pre class="d-example
&lt;button class=&quot;button is-danger is-filled&quot;&gt;filled danger button&lt;/button&gt;</code></pre><div class="d-example-preview undefined"><button class="button is-danger">default danger button</button>
<button class="button is-danger is-outlined">outlined danger button</button>
<button class="button is-danger is-filled">filled danger button</button></div></div>
<p>You can also use any other available secondary colors to create a button of that color (for instance, for informational or success buttons):</p>
<h5 id="example-colors">Example</h5><div class="d-example"><pre class="d-example-code"><code>&lt;button class=&quot;button is-green&quot;&gt;default green button&lt;/button&gt;
&lt;button class=&quot;button is-green is-outlined&quot;&gt;outlined green button&lt;/button&gt;
&lt;button class=&quot;button is-green is-filled&quot;&gt;filled green button&lt;/button&gt;
&lt;button class=&quot;button is-teal&quot;&gt;default teal button&lt;/button&gt;
&lt;button class=&quot;button is-yellow&quot;&gt;default yellow button&lt;/button&gt;</code></pre><div class="d-example-preview undefined"><button class="button is-green">default green button</button>
<button class="button is-green is-outlined">outlined green button</button>
<button class="button is-green is-filled">filled green button</button>
<button class="button is-teal">default teal button</button>
<button class="button is-yellow">default yellow button</button></div></div>
<h2>Muted buttons</h2>
<p>Sometimes actions are not available or should only be considered secondary to others. For these cases, it's possible to use muted buttons.</p>
<p>As primary and danger buttons, muted buttons can have different levels of importance. There are default buttons, which have the least priority, then outlined and then filled buttons.</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/codidact.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/codidact.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/common/common.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/common/common.css.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions docs_src/components/buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ As primary buttons, danger buttons can have different levels of importance. Ther
<button class="button is-danger is-filled">filled danger button</button>
{% endexample %}

You can also use any other available secondary colors to create a button of that color (for instance, for informational or success buttons):

{% example "colors" %}
<button class="button is-green">default green button</button>
<button class="button is-green is-outlined">outlined green button</button>
<button class="button is-green is-filled">filled green button</button>
<button class="button is-teal">default teal button</button>
<button class="button is-yellow">default yellow button</button>
{% endexample %}

## Muted buttons

Sometimes actions are not available or should only be considered secondary to others. For these cases, it's possible to use muted buttons.
Expand Down
Empty file removed example.py
Empty file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codidact/co-design",
"version": "0.12.0",
"version": "0.12.1",
"description": "Co-Design is the design and component framework for Codidact",
"author": "luap42",
"repository": {
Expand Down
46 changes: 46 additions & 0 deletions src/common/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,52 @@
}
}

@each $color-name, $base-color in $secondary-colors {
&.is-#{$color-name} {
background-color: lighten($base-color, 32.5%);
color: darken($base-color, 30%);

&:hover {
background-color: lighten($base-color, 30%);
color: darken($base-color, 30%);
}

&:active, &.is-active {
background-color: lighten($base-color, 25%);
color: darken($base-color, 30%);
}

&.is-outlined {
background-color: #ffffff;
border-color: lighten($base-color, 5%);

&:hover {
background-color: lighten($base-color, 32.5%);
border-color: darken($base-color, 15%);
}

&:active, &.is-active {
background-color: lighten($base-color, 30%);
border-color: darken($base-color, 25%);
}
}

&.is-filled {
background-color: darken($base-color, 15%);
color: white;

&:hover {
background-color: darken($base-color, 25%);
color: white;
}

&:active, &.is-active {
background-color: darken($base-color, 35%);
color: white;
}
}
}
}

&.is-danger {
background-color: lighten($button-danger-color, 32.5%);
Expand Down

0 comments on commit 8a991ae

Please sign in to comment.