discourse/app/assets/stylesheets/common/components/buttons.scss
Sam 42572ff138 Revert font awesome 5 changes
We are still pushing ahead on this 100% just need a bit longer to prepare
all plugins
2018-11-08 16:12:18 +11:00

255 lines
5.5 KiB
SCSS

// --------------------------------------------------
// Buttons
// --------------------------------------------------
// Base
// --------------------------------------------------
.btn {
display: inline-block;
margin: 0;
padding: 6px 12px;
font-weight: 500;
font-size: $font-0;
line-height: $line-height-small;
text-align: center;
cursor: pointer;
transition: all 0.25s;
box-sizing: border-box;
min-height: 30px;
&:active,
&.btn-active {
text-shadow: none;
}
&[disabled],
&.disabled {
cursor: default;
opacity: 0.4;
}
.fa {
margin-right: 7px;
}
&.no-text {
.fa {
margin-right: 0;
}
}
}
.btn.hidden {
display: none;
}
// Default button
// --------------------------------------------------
.btn {
border: none;
color: $primary;
font-weight: normal;
background: $primary-low;
&[href] {
color: $primary;
min-height: unset; // ovverides button defaults
}
.discourse-no-touch & {
// only allow hover on no-touch devices
&:hover,
&.btn-hover {
background: $primary-medium;
color: $secondary;
}
}
&[disabled],
&.disabled {
background: $primary-low;
&:hover {
color: dark-light-choose($primary-low-mid, $secondary-high);
}
cursor: not-allowed;
}
.d-icon {
opacity: 0.7;
line-height: $line-height-medium; // Match button text line-height
}
&.btn-primary .d-icon {
opacity: 1;
}
}
// Primary button
// --------------------------------------------------
.btn-primary {
border: none;
font-weight: normal;
color: $secondary;
background: $tertiary;
&[href] {
color: $secondary;
}
.discourse-no-touch & {
// only allow hover on no-touch devices
&:hover,
&.btn-hover {
background: dark-light-choose(
scale-color($tertiary, $lightness: -20%),
scale-color($tertiary, $lightness: 20%)
);
}
}
&:active,
&.btn-active {
@include linear-gradient(
scale-color($tertiary, $lightness: -20%),
$tertiary
);
}
&[disabled],
&.disabled {
background: $tertiary;
}
}
// Danger button
// --------------------------------------------------
.btn-danger {
color: $secondary;
font-weight: normal;
background: $danger;
&[href] {
color: $secondary;
}
.discourse-no-touch & {
// only allow hover on no-touch devices
&:hover,
&.btn-hover {
background: dark-light-choose(
scale-color($danger, $lightness: -20%),
scale-color($danger, $lightness: 20%)
);
}
}
&:active,
&.btn-active {
@include linear-gradient(scale-color($danger, $lightness: -20%), $danger);
}
&[disabled],
&.disabled {
background: $danger;
}
}
// Social buttons
// --------------------------------------------------
.btn-social {
color: #fff;
&:hover {
color: #fff;
}
&[href] {
color: $secondary;
}
&:before {
margin-right: 9px;
font-family: FontAwesome;
font-size: $font-0;
}
&.google,
&.google_oauth2 {
background: $google;
color: #333;
border: 1px solid $primary-low;
display: flex;
align-items: center;
justify-content: center;
&:before {
content: "";
display: inline-block;
width: 15px;
height: 15px;
// Background image url needs to be encoded for IE11
background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20viewBox%3D%220%200%2048%2048%22%3E%3Cdefs%3E%3Cpath%20id%3D%22a%22%20d%3D%22M44.5%2020H24v8.5h11.8C34.7%2033.9%2030.1%2037%2024%2037c-7.2%200-13-5.8-13-13s5.8-13%2013-13c3.1%200%205.9%201.1%208.1%202.9l6.4-6.4C34.6%204.1%2029.6%202%2024%202%2011.8%202%202%2011.8%202%2024s9.8%2022%2022%2022c11%200%2021-8%2021-22%200-1.3-.2-2.7-.5-4z%22%2F%3E%3C%2Fdefs%3E%3CclipPath%20id%3D%22b%22%3E%3Cuse%20xlink%3Ahref%3D%22%23a%22%20overflow%3D%22visible%22%2F%3E%3C%2FclipPath%3E%3Cpath%20clip-path%3D%22url(%23b)%22%20fill%3D%22%23FBBC05%22%20d%3D%22M0%2037V11l17%2013z%22%2F%3E%3Cpath%20clip-path%3D%22url(%23b)%22%20fill%3D%22%23EA4335%22%20d%3D%22M0%2011l17%2013%207-6.1L48%2014V0H0z%22%2F%3E%3Cpath%20clip-path%3D%22url(%23b)%22%20fill%3D%22%2334A853%22%20d%3D%22M0%2037l30-23%207.9%201L48%200v48H0z%22%2F%3E%3Cpath%20clip-path%3D%22url(%23b)%22%20fill%3D%22%234285F4%22%20d%3D%22M48%2048L17%2024l-4-3%2035-10z%22%2F%3E%3C%2Fsvg%3E");
background-repeat: no-repeat;
background-size: cover;
}
}
.mobile-view & {
// Special case because we're using SVG here
&.google,
&.google_oauth2 {
&:before {
width: 17px;
height: 17px;
}
}
}
&.instagram {
background: $instagram;
&:before {
content: $fa-var-instagram;
}
}
&.facebook {
background: $facebook;
&:before {
content: $fa-var-facebook;
}
}
&.cas {
background: $cas;
}
&.twitter {
background: $twitter;
&:before {
content: $fa-var-twitter;
}
}
&.yahoo {
background: $yahoo;
&:before {
content: $fa-var-yahoo;
}
}
&.github {
background: $github;
&:before {
content: $fa-var-github;
}
}
}
// Button Sizes
// --------------------------------------------------
// Small
.btn-small {
padding: 3px 6px;
font-size: $font-down-1;
}
// Large
.btn-large {
padding: 9px 18px;
font-size: $font-up-1;
line-height: $line-height-small;
}
.btn-flat {
background: transparent;
border: 0;
outline: 0;
line-height: $line-height-small;
.d-icon {
opacity: 0.7;
}
}