284 lines
6 KiB
SCSS
284 lines
6 KiB
SCSS
// Copyright 2021 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
.module-Button {
|
|
@mixin focus-box-shadow($inner-color, $outer-color) {
|
|
&:focus {
|
|
box-shadow:
|
|
0 0 0 1px $inner-color,
|
|
0 0 0 4px $outer-color;
|
|
}
|
|
}
|
|
|
|
@mixin hover-and-active-states($background-color, $mix-color) {
|
|
&:hover {
|
|
@include not-disabled {
|
|
background: mix($background-color, $mix-color, 85%);
|
|
}
|
|
}
|
|
&:active {
|
|
@include not-disabled {
|
|
background: mix($background-color, $mix-color, 75%);
|
|
}
|
|
}
|
|
}
|
|
|
|
@include button-reset;
|
|
border-radius: 4px;
|
|
padding-block: 8px;
|
|
padding-inline: 16px;
|
|
text-align: center;
|
|
user-select: none;
|
|
-webkit-app-region: no-drag;
|
|
|
|
@include keyboard-mode {
|
|
@include focus-box-shadow($color-white, $color-ultramarine);
|
|
}
|
|
|
|
@include dark-keyboard-mode {
|
|
@include focus-box-shadow($color-black, $color-ultramarine-icon);
|
|
}
|
|
|
|
@include disabled {
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
&--large {
|
|
@include font-title-2;
|
|
font-weight: bold;
|
|
}
|
|
|
|
&--medium {
|
|
@include font-body-1-bold;
|
|
}
|
|
|
|
&--small {
|
|
@include font-body-2;
|
|
@include rounded-corners;
|
|
padding-block: 6px;
|
|
padding-inline: 12px;
|
|
}
|
|
|
|
&--primary {
|
|
$color: $color-white;
|
|
$background-color: $color-ultramarine;
|
|
|
|
color: $color;
|
|
background: $background-color;
|
|
|
|
@include disabled {
|
|
color: fade-out($color, 0.4);
|
|
background: fade-out($background-color, 0.6);
|
|
}
|
|
|
|
@include light-theme {
|
|
@include hover-and-active-states($background-color, $color-black);
|
|
}
|
|
|
|
@include dark-theme {
|
|
@include hover-and-active-states($background-color, $color-white);
|
|
}
|
|
}
|
|
|
|
&--secondary {
|
|
@include light-theme {
|
|
$color: $color-gray-90;
|
|
$background-color: $color-gray-05;
|
|
|
|
color: $color;
|
|
background: $background-color;
|
|
|
|
@include disabled {
|
|
color: $color-black-alpha-40;
|
|
background: fade-out($background-color, 0.6);
|
|
}
|
|
|
|
&--affirmative {
|
|
color: $color-ultramarine;
|
|
}
|
|
|
|
&--destructive {
|
|
color: $color-accent-red;
|
|
}
|
|
|
|
@include hover-and-active-states($background-color, $color-black);
|
|
}
|
|
|
|
@include dark-theme {
|
|
$color: $color-gray-05;
|
|
$background-color: $color-gray-65;
|
|
|
|
color: $color;
|
|
background: $background-color;
|
|
|
|
@include disabled {
|
|
color: $color-white-alpha-20;
|
|
background: fade-out($background-color, 0.6);
|
|
}
|
|
|
|
&--affirmative {
|
|
color: $color-ultramarine-light;
|
|
}
|
|
|
|
&--destructive {
|
|
color: $color-accent-red;
|
|
}
|
|
|
|
@include hover-and-active-states($background-color, $color-white);
|
|
}
|
|
}
|
|
|
|
&--destructive {
|
|
$color: $color-white;
|
|
$background-color: $color-accent-red;
|
|
|
|
color: $color;
|
|
background: $background-color;
|
|
|
|
@include disabled {
|
|
color: fade-out($color, 0.4);
|
|
background: fade-out($background-color, 0.6);
|
|
}
|
|
|
|
@include light-theme {
|
|
@include hover-and-active-states($background-color, $color-black);
|
|
}
|
|
|
|
@include dark-theme {
|
|
@include hover-and-active-states($background-color, $color-white);
|
|
}
|
|
}
|
|
|
|
&--calling {
|
|
$color: $color-white;
|
|
$background-color: $color-accent-green;
|
|
|
|
@include rounded-corners;
|
|
color: $color;
|
|
background: $background-color;
|
|
|
|
@include disabled {
|
|
color: fade-out($color, 0.4);
|
|
background: fade-out($background-color, 0.6);
|
|
}
|
|
|
|
@include light-theme {
|
|
@include hover-and-active-states($background-color, $color-black);
|
|
}
|
|
|
|
@include dark-theme {
|
|
@include hover-and-active-states($background-color, $color-white);
|
|
}
|
|
}
|
|
|
|
&--system-message {
|
|
@include rounded-corners;
|
|
|
|
&.module-Button--small {
|
|
padding-top: 5px;
|
|
padding-bottom: 5px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
@include light-theme {
|
|
$color: $color-ultramarine;
|
|
$background-color: $color-gray-02;
|
|
|
|
color: $color;
|
|
background: $background-color;
|
|
|
|
@include disabled {
|
|
color: fade-out($color, 0.4);
|
|
background: fade-out($background-color, 0.6);
|
|
}
|
|
@include hover-and-active-states($background-color, $color-black);
|
|
}
|
|
|
|
@include dark-theme {
|
|
$color: $color-white;
|
|
$background-color: $color-gray-65;
|
|
|
|
color: $color;
|
|
background: $background-color;
|
|
|
|
@include disabled {
|
|
color: fade-out($color, 0.4);
|
|
background: fade-out($background-color, 0.6);
|
|
}
|
|
@include hover-and-active-states($background-color, $color-white);
|
|
}
|
|
}
|
|
|
|
&--details {
|
|
align-items: center;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-size: 11px;
|
|
justify-content: center;
|
|
line-height: 10px;
|
|
min-height: 44px;
|
|
min-width: 68px;
|
|
padding: 8px;
|
|
|
|
@include light-theme {
|
|
background-color: $color-gray-05;
|
|
color: $color-black;
|
|
}
|
|
|
|
@include dark-theme {
|
|
background-color: $color-gray-65;
|
|
color: $color-gray-05;
|
|
}
|
|
|
|
&:focus {
|
|
@include keyboard-mode {
|
|
box-shadow: 0 0 0 2px $color-ultramarine;
|
|
}
|
|
}
|
|
|
|
&::before {
|
|
margin-bottom: 6px;
|
|
}
|
|
}
|
|
|
|
&--icon {
|
|
@mixin button-icon($icon) {
|
|
content: '';
|
|
display: block;
|
|
height: 18px;
|
|
width: 18px;
|
|
|
|
@include light-theme {
|
|
@include color-svg($icon, $color-black);
|
|
}
|
|
@include dark-theme {
|
|
@include color-svg($icon, $color-gray-05);
|
|
}
|
|
}
|
|
|
|
&--audio::before {
|
|
@include button-icon('../images/icons/v3/phone/phone-compact.svg');
|
|
}
|
|
|
|
&--message::before {
|
|
@include button-icon('../images/icons/v3/chat/chat-compact.svg');
|
|
}
|
|
|
|
&--muted::before {
|
|
@include button-icon('../images/icons/v3/bell/bell-slash-compact.svg');
|
|
}
|
|
|
|
&--search::before {
|
|
@include button-icon('../images/icons/v3/search/search-compact.svg');
|
|
}
|
|
|
|
&--unmuted::before {
|
|
@include button-icon('../images/icons/v3/bell/bell-compact.svg');
|
|
}
|
|
|
|
&--video::before {
|
|
@include button-icon('../images/icons/v3/video/video-compact.svg');
|
|
}
|
|
}
|
|
}
|