Skip to content

Commit

Permalink
Add Unelevated Button
Browse files Browse the repository at this point in the history
  • Loading branch information
finnhvman committed Mar 24, 2019
1 parent 96c9a5c commit aacd697
Show file tree
Hide file tree
Showing 8 changed files with 414 additions and 4 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@

### Buttons
```html
<!-- Button Markup; Classes: matter-button-contained, matter-button-outlined, matter-button-text -->
<!-- Button Markup; Classes: matter-button-contained, matter-button-outlined, matter-button-text, -->
<!-- matter-button-unelevated -->
<button class="matter-button-contained">BUTTON</button>

<!-- Button Examples: Contained, Outlined and Text Buttons -->
<!-- Button Examples: Contained, Outlined, Text and Unelevated Buttons -->
<button class="matter-button-contained">CONTAINED</button>

<button class="matter-button-outlined">OUTLINED</button>

<button class="matter-button-text">TEXT</button>

<button class="matter-button-unelevated">UNELEVATED</button>

```

### Colors
Expand Down Expand Up @@ -130,6 +134,7 @@ Click the link of a component in the next section to find more examples of its u
* [x] [Contained](./src/components/buttons/contained)
* [x] [Outlined](./src/components/buttons/outlined)
* [x] [Text](./src/components/buttons/text)
* [x] [Unelevated](./src/components/buttons/unelevated)
* [x] [Colors](./src/utilities/colors)
* [x] Progress Indicators
* [x] [Circular](./src/components/progress/circular)
Expand Down
73 changes: 73 additions & 0 deletions dist/matter.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,79 @@
.matter-button-contained:disabled::after {
opacity: 0;
}
/* Button Unelevated */
.matter-button-unelevated {
--matter-helper-theme: var(--matter-theme-rgb, var(--matter-primary-rgb, 33, 150, 243));
--matter-helper-ontheme: var(--matter-ontheme-rgb, var(--matter-onprimary-rgb, 255, 255, 255));
position: relative;
display: inline-block;
box-sizing: border-box;
border: none;
border-radius: 4px;
padding: 0 16px;
min-width: 64px;
height: 36px;
vertical-align: middle;
text-align: center;
text-overflow: ellipsis;
color: rgb(var(--matter-helper-ontheme));
background-color: rgb(var(--matter-helper-theme));
font-family: var(--matter-font-family, "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system);
font-size: 14px;
font-weight: 500;
line-height: 36px;
outline: none;
cursor: pointer;
}
.matter-button-unelevated::-moz-focus-inner {
border: none;
}
/* Highlight, Ripple */
.matter-button-unelevated::before,
.matter-button-unelevated::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: inherit;
opacity: 0;
}
.matter-button-unelevated::before {
background-color: rgb(var(--matter-helper-ontheme));
transition: opacity 0.2s;
}
.matter-button-unelevated::after {
background: radial-gradient(circle at center, currentColor 1%, transparent 1%) center/10000% 10000% no-repeat;
transition: opacity 1s, background-size 0.5s;
}
/* Hover, Focus */
.matter-button-unelevated:hover::before {
opacity: 0.08;
}
.matter-button-unelevated:focus::before {
opacity: 0.24;
}
.matter-button-unelevated:hover:focus::before {
opacity: 0.32;
}
/* Active */
.matter-button-unelevated:active::after {
opacity: 0.32;
background-size: 100% 100%;
transition: background-size 0s;
}
/* Disabled */
.matter-button-unelevated:disabled {
color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.38);
background-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.12);
cursor: initial;
}
.matter-button-unelevated:disabled::before,
.matter-button-unelevated:disabled::after {
opacity: 0;
}
/* Button Outlined */
.matter-button-outlined {
--matter-helper-theme: var(--matter-theme-rgb, var(--matter-primary-rgb, 33, 150, 243));
Expand Down
2 changes: 1 addition & 1 deletion dist/matter.min.css

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions src/components/buttons/unelevated/button-unelevated.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
.matter-button-unelevated {
--matter-helper-theme: var(--matter-theme-rgb, var(--matter-primary-rgb, 33, 150, 243));
--matter-helper-ontheme: var(--matter-ontheme-rgb, var(--matter-onprimary-rgb, 255, 255, 255));
position: relative;
display: inline-block;
box-sizing: border-box;
border: none;
border-radius: 4px;
padding: 0 16px;
min-width: 64px;
height: 36px;
vertical-align: middle;
text-align: center;
text-overflow: ellipsis;
color: rgb(var(--matter-helper-ontheme));
background-color: rgb(var(--matter-helper-theme));
font-family: var(--matter-font-family, "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system);
font-size: 14px;
font-weight: 500;
line-height: 36px;
outline: none;
cursor: pointer;
}

.matter-button-unelevated::-moz-focus-inner {
border: none;
}

/* Highlight, Ripple */
.matter-button-unelevated::before,
.matter-button-unelevated::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: inherit;
opacity: 0;
}

.matter-button-unelevated::before {
background-color: rgb(var(--matter-helper-ontheme));
transition: opacity 0.2s;
}

.matter-button-unelevated::after {
background: radial-gradient(circle at center, currentColor 1%, transparent 1%) center/10000% 10000% no-repeat;
transition: opacity 1s, background-size 0.5s;
}

/* Hover, Focus */
.matter-button-unelevated:hover::before {
opacity: 0.08;
}

.matter-button-unelevated:focus::before {
opacity: 0.24;
}

.matter-button-unelevated:hover:focus::before {
opacity: 0.32;
}

/* Active */
.matter-button-unelevated:active::after {
opacity: 0.32;
background-size: 100% 100%;
transition: background-size 0s;
}

/* Disabled */
.matter-button-unelevated:disabled {
color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.38);
background-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.12);
cursor: initial;
}

.matter-button-unelevated:disabled::before,
.matter-button-unelevated:disabled::after {
opacity: 0;
}
5 changes: 5 additions & 0 deletions src/components/buttons/unelevated/button-unelevated.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"degradation": [
"The ripple effect always comes from the center"
]
}
11 changes: 11 additions & 0 deletions src/components/buttons/unelevated/button-unelevated.spec.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<link href="button-unelevated.css" rel="stylesheet">

<button id="normal" class="matter-button-unelevated">BUTTON</button>
<br/><br/>
<button id="min" class="matter-button-unelevated">MIN</button>
<br/><br/>
<button id="sized" class="matter-button-unelevated" style="width: 120px">SIZED</button>
<br/><br/>
<button id="disabled" class="matter-button-unelevated" disabled>DISABLED</button>
<br/><br/>
<button id="xmas" class="matter-button-unelevated" style="width: 120px">XMAS TREE</button>
Loading

0 comments on commit aacd697

Please sign in to comment.