forgejo/web_src/css/modules/button.css
0ko b1ba9b06b2 feat(ui): dangerous buttons (#9652)
Followup to https://codeberg.org/forgejo/forgejo/pulls/9359:
* add dangerous buttons type
    * they will be replacing `red` and `negative` buttons and don't have some of their problems:
        * they aren't as eye-catching and bright like `red` on dark and `negative` on both themes
        * they aren't as bland as `red` on light theme
        * ...they are consistent!
    * added them to the danger zone of repo settings for this initial PR

Preview:
- https://codeberg.org/attachments/e4d71f45-9455-4435-ab99-6e1bd2628d05
- https://codeberg.org/attachments/3056d3e1-d7b0-4417-8f2c-8fa34b399911

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9652
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2025-10-20 12:03:17 +02:00

102 lines
2.4 KiB
CSS

/* Copyright 2024-2025 The Forgejo Authors. All rights reserved.
* SPDX-License-Identifier: GPL-3.0-or-later */
:root {
--button-min-height: 36px;
--button-padding-inline: 1.35rem;
}
:root .small:is(.button, .button-row, .button-sequence) {
--button-min-height: 34px;
--button-padding-inline: 1.25rem;
}
@media (pointer: coarse) {
:root {
--button-min-height: 40px;
}
:root .small:is(.button, .button-row, .button-sequence) {
--button-min-height: 38px;
}
}
.button {
display: inline-flex;
align-items: center;
min-height: var(--button-min-height);
padding-block: 0;
padding-inline: var(--button-padding-inline);
justify-content: center;
gap: 0.5rem;
border-radius: var(--border-radius);
&:hover,
&:focus {
text-decoration: none;
}
}
.button.primary {
background: var(--color-primary);
color: var(--color-primary-contrast);
&:hover,
&:focus {
background-color: var(--color-primary-hover);
}
}
.button.secondary {
background: var(--color-button);
border: 1px solid var(--color-light-border);
color: var(--color-text-light);
&:hover,
&:focus {
color: var(--color-text);
}
}
.button.danger {
/* Fallbacks are needed while -thin vars are not supplied by all themes */
background: var(--color-danger-bg, var(--color-error-bg));
border: 1px solid var(--color-thin-red, var(--color-red));
color: var(--color-thin-red, var(--color-red));
font-weight: var(--font-weight-medium);
&:hover,
&:focus {
color: var(--color-thin-red-highlight, var(--color-red));
}
}
/* Dropdown openers should be at least tall as buttons they are in line with, and
* as wide as they are tall */
:is(.button-row, .button-sequence) details.dropdown summary {
min-height: var(--button-min-height);
min-width: var(--button-min-height);
}
/* button-row is a simple helper made to improve consistency of fomantic buttons
* placed in a row. It provides gap and cancels out fomantic's margins */
.button-row {
gap: var(--button-spacing);
}
/* button-sequence is a more complex helper that has wrap. Using it is preferred
* but also requires deeper consideration */
.button-sequence {
display: flex;
flex-flow: wrap;
gap: var(--button-spacing);
}
/* Fomantic buttons have annoying margins to set distance between elements. In
* the button-row/sequence helpers this is set by flex+gap */
.button-row .ui.button {
margin-right: 0;
}
.button-sequence .ui.button {
margin: 0 !important;
}