pico/scss/content/_button.scss

108 lines
2.1 KiB
SCSS
Raw Normal View History

2019-11-27 15:31:49 +07:00
/**
* Button
*/
// Reboot
// Based on normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
//
// 1. Change the font styles in all browsers.
// 2. Remove the margin in Firefox and Safari
// 3. Show the overflow in Edge
button {
margin: 0; // 2
overflow: visible; // 3
font-family: inherit; // 1
text-transform: none; // 1
}
// Correct the inability to style clickable types in iOS and Safari.
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
// Remove the inner border and padding in Firefox.
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
// Restore the focus styles unset by the previous rule.
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
// Pico
//
button {
display: block;
width: 100%;
margin-bottom: $spacing-typography;
}
a[role="button"] {
display: inline-block;
text-decoration: none;
}
button,
input[type="submit"],
a[role="button"] {
padding: $spacing-input-button;
border: 1px solid var(--primary);
border-radius: $round;
outline: none;
background-color: var(--primary);
color: var(--primary-inverse);
font-size: 1rem;
font-weight: normal;
line-height: $line-height;
text-align: center;
cursor: pointer;
transition:
background-color $transition,
border-color $transition,
color $transition,
box-shadow $transition;
&:hover,
&:active,
&:focus {
border: 1px solid var(--primary-hover);
background-color: var(--primary-hover);
}
&:focus {
box-shadow: 0 0 0 0.2rem var(--primary-focus);
}
}
// Input [type="reset"]
input[type="reset"] {
cursor: pointer;
}
// Button [disabled]
button,
input[type="submit"],
input[type="reset"],
a[role="button"] {
&[disabled] {
opacity: .5;
pointer-events: none;
}
}