Modrinth/assets/styles/components.scss
Ennui Langeweile 074695b50c
Remove bottom padding on <details>' last element (#748)
* Remove bottom padding on <details>' last element

* Fix linting screwup, refine the fix

* Fix linting for real
2022-11-17 22:03:02 -05:00

1274 lines
23 KiB
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Here lies 𝖄𝖊 𝕸𝖆𝖗𝖌𝖎𝖓 𝕸𝖆𝖌𝖎𝖈
// which allows to have just one wrapper div
.iconified-input {
align-items: center;
display: inline-flex;
position: relative;
input {
padding-left: 2.25rem;
width: 100%;
}
&:focus-within svg {
color: var(--color-button-text-active);
opacity: 1;
}
svg {
position: absolute;
left: 0.75rem;
height: 1.25rem;
width: 1.25rem;
z-index: 1;
color: var(--color-button-text);
opacity: 0.6;
}
}
.badge {
max-height: 1rem;
border-radius: 1rem;
font-size: var(--font-size-xs);
font-weight: bold;
letter-spacing: 0.02rem;
padding: 0.25rem 0.5rem;
&.gray {
background-color: var(--color-badge-gray-bg);
color: var(--color-badge-gray-text);
}
&.red {
background-color: var(--color-badge-red-bg);
color: var(--color-badge-red-text);
}
&.green {
background-color: var(--color-badge-green-bg);
color: var(--color-badge-green-text);
}
&.yellow {
background-color: var(--color-badge-yellow-bg);
color: var(--color-badge-yellow-text);
}
}
.text-link {
color: var(--color-link);
text-decoration: underline;
&:focus-visible,
&:hover {
color: var(--color-link-hover);
}
&:active {
color: var(--color-link-active);
}
}
.title-link {
text-decoration: underline;
&:focus-visible,
&:hover {
color: var(--color-heading);
}
&:active {
color: var(--color-text-dark);
}
}
.markdown-body {
h1:first-child {
margin-top: 0;
}
blockquote,
details,
dl,
ol,
p,
code,
pre,
table,
ul {
margin-top: 0;
margin-bottom: 16px;
}
li,
p {
padding: 0;
line-height: 1.5;
}
h1,
h2 {
padding: 10px 0 5px;
border-bottom: 1px solid var(--color-header-underline);
}
h1, h2, h3, h4, h5, h6, li, p {
word-wrap: break-word;
overflow-wrap: anywhere;
}
blockquote {
padding: 0 1em;
color: var(--color-text);
border-left: 0.25em solid var(--color-block-quote);
}
a {
color: var(--color-link);
&:focus-visible,
&:hover {
color: var(--color-link-hover);
}
&:active {
color: var(--color-link-active);
}
}
img {
max-width: 100%;
height: auto;
}
html:not(.dark-mode, .oled-mode) & img[src$='#gh-dark-mode-only'] {
display: none;
}
html:is(.dark-mode, .oled-mode) & img[src$='#gh-light-mode-only'] {
display: none;
}
pre {
margin-top: 1rem;
padding: 14px;
border-radius: var(--size-rounded-sm);
background-color: var(--color-code-bg);
overflow-x: auto;
code {
font-size: 80%;
padding: 0;
border-radius: 0;
}
}
code {
padding: 0.2em 0.4em;
font-size: 80%;
border-radius: var(--size-rounded-sm);
background-color: var(--color-code-bg);
color: var(--color-code-text);
}
hr {
margin: 20px 0;
color: var(--color-divider);
}
table {
display: block;
width: max-content;
max-width: 100%;
overflow: auto;
border-collapse: separate;
border-spacing: 0;
line-height: 1.5;
border: 0.05rem solid var(--color-table-border);
border-radius: var(--size-rounded-sm);
th {
font-weight: 600;
}
td,
th {
padding: 0.4rem 0.85rem;
border: 0.05rem solid var(--color-table-border);
}
tr:nth-child(2n) {
background-color: var(--color-table-alternate-row);
}
th:first-of-type {
border-top-left-radius: var(--size-rounded-sm);
}
th:last-of-type {
border-top-right-radius: var(--size-rounded-sm);
}
tr:last-of-type td:first-of-type {
border-bottom-left-radius: var(--size-rounded-sm);
}
tr:last-of-type td:last-of-type {
border-bottom-right-radius: var(--size-rounded-sm);
}
}
details {
border: 0.15rem solid var(--color-button-bg);
border-radius: var(--size-rounded-sm);
padding: 0.5rem 0.5rem 0;
summary {
font-weight: bold;
margin: -0.5rem -0.5rem 0;
padding: 0.5rem 0.8rem;
cursor: pointer;
background-color: var(--color-button-bg);
border-radius: var(--size-rounded-xs);
&:hover {
background-color: var(--color-button-bg-hover);
}
}
&[open] {
padding: 0.5rem;
summary {
margin-bottom: 0.5rem;
border-radius: var(--size-rounded-xs) var(--size-rounded-xs) 0 0;
}
> :last-child:not(summary) {
margin-bottom: 0 !important;
}
}
}
> :last-child {
margin-bottom: 0 !important;
}
@media screen and (max-width: 850px) {
iframe {
aspect-ratio: 16 / 9;
width: 100%;
height: auto;
}
}
}
.tooltip {
display: block !important;
z-index: 10000;
transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
.tooltip-inner {
background: var(--color-tooltip-bg);
color: var(--color-tooltip-text);
padding: 5px 10px 4px;
border-radius: var(--size-rounded-tooltip);
box-shadow: var(--shadow-floating);
font-size: 0.9rem;
}
.tooltip-arrow {
width: 0;
height: 0;
border-style: solid;
position: absolute;
margin: 5px;
border-color: var(--color-tooltip-bg);
z-index: 1;
}
&[x-placement^='top'] {
margin-bottom: 5px;
.tooltip-arrow {
border-width: 5px 5px 0 5px;
border-left-color: transparent !important;
border-right-color: transparent !important;
border-bottom-color: transparent !important;
bottom: -5px;
left: calc(50% - 5px);
margin-top: 0;
margin-bottom: 0;
}
}
&[x-placement^='bottom'] {
margin-top: 5px;
.tooltip-arrow {
border-width: 0 5px 5px 5px;
border-left-color: transparent !important;
border-right-color: transparent !important;
border-top-color: transparent !important;
top: -5px;
left: calc(50% - 5px);
margin-top: 0;
margin-bottom: 0;
}
}
&[x-placement^='right'] {
margin-left: 5px;
.tooltip-arrow {
border-width: 5px 5px 5px 0;
border-left-color: transparent !important;
border-top-color: transparent !important;
border-bottom-color: transparent !important;
left: -5px;
top: calc(50% - 5px);
margin-left: 0;
margin-right: 0;
}
}
&[x-placement^='left'] {
margin-right: 5px;
.tooltip-arrow {
border-width: 5px 0 5px 5px;
border-top-color: transparent !important;
border-right-color: transparent !important;
border-bottom-color: transparent !important;
right: -5px;
top: calc(50% - 5px);
margin-left: 0;
margin-right: 0;
}
}
&[aria-hidden='true'] {
visibility: hidden;
opacity: 0;
}
&[aria-hidden='false'] {
visibility: visible;
opacity: 1;
}
}
.button-animation {
transition: opacity 0.5s ease-in-out, filter 0.2s ease-in-out, transform 0.05s ease-in-out,
outline 0.2s ease-in-out;
&:active:not(&:disabled) {
transform: scale(0.95);
}
}
.button-base {
@extend .button-animation;
font-weight: 500;
&:focus-visible:not(&:disabled),
&:hover:not(&:disabled) {
cursor: pointer;
filter: brightness(0.85);
}
&:active:not(&:disabled) {
filter: brightness(0.8);
}
&:disabled,
&[disabled] {
cursor: not-allowed;
filter: grayscale(50%);
opacity: 0.5;
box-shadow: none;
}
}
:not(tr).button-transparent {
@extend .button-base;
background-color: transparent;
border-radius: var(--size-rounded-sm);
&:focus-visible:not(&:disabled),
&:hover:not(&:disabled),
&:active:not(&:disabled) {
background-color: var(--color-raised-bg);
}
}
tr.button-transparent {
@extend .button-animation;
background-color: transparent;
border-radius: var(--size-rounded-sm);
&:focus-visible:not(&:disabled) > *,
&:hover:not(&:disabled) > * {
cursor: pointer;
filter: brightness(0.85);
background-color: var(--color-raised-bg);
}
&:active:not(&:disabled) > * {
filter: brightness(0.8);
background-color: var(--color-raised-bg);
}
&:disabled > *,
&[disabled] > * {
cursor: not-allowed;
filter: grayscale(50%);
opacity: 0.5;
box-shadow: none;
}
}
.button-within {
transition: opacity 0.5s ease-in-out, filter 0.2s ease-in-out, transform 0.05s ease-in-out,
outline 0.2s ease-in-out;
&:focus-visible:not(&.disabled),
&:hover:not(&.disabled) {
filter: brightness(0.85);
}
&:active:not(&.disabled) {
filter: brightness(0.8);
}
// For some reason this within the above block makes it universal and not only applied to children. SCSS bug maybe?
&:active:not(&.disabled) button:not(&:disabled) {
transform: scale(0.95);
}
&.disabled {
cursor: not-allowed;
filter: grayscale(50%);
opacity: 0.5;
box-shadow: none;
&disabled,
&[disabled] {
cursor: not-allowed;
box-shadow: none;
}
}
}
.iconified-button {
@extend .button-base;
--text-color: var(--color-button-text);
--background-color: var(--color-button-bg);
box-sizing: border-box;
display: flex;
padding: var(--spacing-card-sm) var(--spacing-card-bg);
margin: 0;
font-size: var(--font-size-nm);
align-items: center;
cursor: pointer;
box-shadow: var(--shadow-inset-sm), 0 0 0 0 transparent;
width: fit-content;
height: fit-content;
color: var(--text-color);
background-color: var(--background-color);
text-decoration: none;
border-radius: var(--size-rounded-sm);
svg {
width: 1.1rem;
height: 1.1rem;
margin-right: 0.5rem;
}
&.icon-only {
padding: 0 0.5rem;
svg {
margin-right: 0;
}
}
&.transparent {
background: none;
box-shadow: none;
}
&.bold-button {
font-weight: bold;
}
}
.header-button {
@extend .iconified-button;
box-sizing: content-box;
min-height: unset;
border-radius: var(--size-rounded-max);
white-space: nowrap;
padding: 0.5rem 0.75rem;
max-height: 1.75rem;
svg {
vertical-align: middle;
margin-right: 0.5rem;
height: 1.25rem;
width: 1.25rem;
}
}
.raised-button {
--background-color: var(--color-raised-bg);
box-shadow: var(--shadow-inset-sm), var(--shadow-raised);
}
.danger-button {
--background-color: var(--color-badge-red-bg);
--text-color: var(--color-brand-inverted);
}
.brand-button {
--background-color: var(--color-brand);
--text-color: var(--color-brand-inverted);
}
.button-group {
display: flex;
grid-gap: var(--spacing-card-sm);
flex-wrap: wrap;
}
.multiselect--above .multiselect__content-wrapper {
border-top: none !important;
border-top-left-radius: var(--size-rounded-card) !important;
border-top-right-radius: var(--size-rounded-card) !important;
}
.known-error .multiselect__tags {
border-color: var(--color-badge-red-bg) !important;
background-color: var(--color-warning-bg) !important;
&::placeholder {
color: var(--color-warning-text);
}
}
.multiselect {
color: var(--color-text) !important;
input {
background: transparent;
box-shadow: none;
}
input::placeholder {
color: var(--color-text);
}
.multiselect__tags {
border-radius: var(--size-rounded-sm);
background: var(--color-dropdown-bg);
box-shadow: var(--shadow-inset-sm);
border: none;
cursor: pointer;
padding-left: 7px;
padding-top: 10px;
transition: background-color .1s ease-in-out;
&:active {
background: var(--color-button-bg-hover);
.multiselect__spinner {
background: var(--color-button-bg-hover);
}
}
.multiselect__single {
background: transparent;
}
.multiselect__tag {
border-radius: var(--size-rounded-sm);
color: var(--color-text-dark);
background: transparent;
border: 2px solid var(--color-brand);
}
.multiselect__tag-icon {
background: transparent;
&:after {
color: var(--color-text-dark);
}
}
.multiselect__placeholder {
color: var(--color-button-text);
margin-left: 8px;
opacity: 0.6;
font-size: 16px;
line-height: 20px;
}
}
.multiselect__content-wrapper {
background: var(--color-dropdown-bg);
border: none;
overflow-x: hidden;
border-bottom-left-radius: var(--size-rounded-sm);
border-bottom-right-radius: var(--size-rounded-sm);
box-shadow: var(--shadow-inset-sm), var(--shadow-floating);
.multiselect__element {
.multiselect__option--highlight {
background: var(--color-button-bg-active);
color: var(--color-text-dark);
}
.multiselect__option--selected {
background: var(--color-brand);
font-weight: bold;
color: var(--color-brand-inverted);
}
}
}
.multiselect__spinner {
background: var(--color-dropdown-bg);
&:active {
background: var(--color-button-bg-hover);
}
}
&.multiselect--disabled {
background: none;
.multiselect__current,
.multiselect__select {
background: none;
}
}
}
.switch {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
&:focus {
//outline: 0; Bad for accessibility
}
}
.stylized-toggle {
@extend .button-base;
box-sizing: content-box;
min-height: 32px;
height: 32px;
width: 52px;
max-width: 52px;
border-radius: var(--size-rounded-max);
display: inline-block;
position: relative;
margin: 0;
transition: all 0.2s ease;
background: var(--color-button-bg);
&:after {
content: '';
position: absolute;
top: 7px;
left: 7px;
width: 18px;
height: 18px;
border-radius: 50%;
background: var(--color-toggle-handle);
transition: all 0.2s cubic-bezier(0.5, 0.1, 0.75, 1.35);
@media (prefers-reduced-motion) {
transition: none;
}
}
&:checked {
background-color: var(--color-brand);
&:after {
transform: translatex(20px);
background: var(--color-brand-inverted);
}
}
&:hover &:focus {
background: var(--color-button-bg);
}
}
.download-button {
@extend .button-base;
display: flex;
align-items: center;
height: 2.25rem;
width: 2.25rem;
border-radius: var(--size-rounded-sm);
color: var(--color-brand-inverted);
background-color: var(--color-brand);
margin-right: var(--spacing-card-sm);
svg {
width: 1.25rem;
height: 1.25rem;
margin: auto;
}
flex-shrink: 0;
}
.textarea-wrapper {
display: flex;
flex-direction: column;
align-items: stretch;
textarea {
border-radius: var(--size-rounded-sm);
flex: 1;
overflow-y: auto;
resize: none;
max-width: 100%;
}
}
.error {
display: flex;
flex-direction: column;
width: 100%;
justify-content: center;
align-items: center;
.icon {
width: 8rem;
height: 8rem;
margin: 1.5rem 0;
}
.text {
margin-bottom: 2rem;
font-size: 1.25rem;
text-align: center;
}
.link {
cursor: pointer;
text-decoration: underline;
}
}
.card {
position: relative;
min-height: var(--font-size-2xl);
padding: var(--spacing-card-md) var(--spacing-card-lg);
background: var(--color-raised-bg);
border-radius: var(--size-rounded-card);
margin-bottom: var(--spacing-card-md);
box-shadow: var(--shadow-card);
.card__overlay {
position: absolute;
top: 1rem;
right: 1rem;
display: flex;
flex-direction: column;
align-items: flex-end;
grid-gap: .5rem;
z-index: 2;
}
&.warning {
border-left: 0.5rem solid var(--color-banner-side);
padding: 1.5rem;
line-height: 1.5;
background-color: var(--color-banner-bg);
color: var(--color-banner-text);
min-height: 0;
a {
/* Uses active color to increase contrast */
color: var(--color-link-active);
text-decoration: underline;
}
}
}
.vue-notification {
background: #44a4fc;
border-left: 5px solid #44a4fc;
&.success {
background: #68cd86;
border-left-color: #68cd86;
}
&.warn {
background: #ffb648;
border-left-color: #ffb648;
}
&.error {
background: #e54d42;
border-left-color: #e54d42;
}
}
.vue-notification-group {
right: 25px !important;
bottom: 25px !important;
.vue-notification-wrapper {
margin-bottom: 10px;
.vue-notification-template {
border-radius: var(--size-rounded-card);
margin: 0;
.notification-title {
font-size: var(--font-size-lg);
margin-right: auto;
}
.notification-content {
font-size: var(--font-size-md);
}
}
&:last-child {
margin: 0;
}
}
@media screen and (max-width: 750px) {
transition: bottom 0.25s ease-in-out;
bottom: calc(var(--size-mobile-navbar-height) + 10px) !important;
&.browse-menu-open {
bottom: calc(var(--size-mobile-navbar-height-expanded) + 10px) !important;
}
}
}
.card-divider {
background-color: var(--color-divider);
border: none;
color: var(--color-divider);
height: 1px;
margin: var(--spacing-card-bg) 0;
}
.text-input-wrapper.known-error,
input.known-error,
textarea.known-error {
outline: 2px solid var(--color-badge-red-bg);
background-color: var(--color-warning-bg) !important;
&::placeholder {
color: var(--color-warning-text);
}
}
.known-errors {
color: var(--color-badge-red-bg);
ul {
margin: 0;
}
}
.goto-link {
display: flex;
align-items: center;
gap: 3px;
color: var(--color-link);
}
.goto-link:hover,
.goto-link:focus-visible {
color: var(--color-link-hover);
}
.goto-link:active {
color: var(--color-link-active);
}
h1 {
.beta-badge {
font-size: 0.4em;
}
}
.beta-badge {
font-size: 0.7em;
padding: 0.2rem 0.4rem;
background-color: transparent;
box-sizing: border-box;
border: 2px solid var(--color-text);
color: var(--color-text);
border-radius: var(--size-rounded-max);
margin-left: 0.5rem;
font-weight: bold;
}
.nuxt-link-exact-active, h1, h2, h3 {
.beta-badge {
background-color: var(--color-button-text-active);
box-sizing: border-box;
border-color: transparent;
color: var(--color-raised-bg);
}
}
@media (prefers-reduced-motion) {
.button-animation, button {
transform: none !important;
}
}
.base-card {
@extend .padding-lg;
position: relative;
min-height: var(--font-size-2xl);
background-color: var(--color-raised-bg);
border-radius: var(--size-rounded-card);
margin-bottom: var(--spacing-card-md);
box-shadow: var(--shadow-card);
.card__overlay {
position: absolute;
top: 1rem;
right: 1rem;
display: flex;
flex-direction: column;
align-items: flex-end;
grid-gap: .5rem;
z-index: 2;
}
&.warning {
border-left: 0.5rem solid var(--color-banner-side);
padding: 1.5rem;
line-height: 1.5;
background-color: var(--color-banner-bg);
color: var(--color-banner-text);
min-height: 0;
a {
/* Uses active color to increase contrast */
color: var(--color-link-active);
text-decoration: underline;
}
}
}
.universal-labels {
label, .label {
.label__title {
display: block;
margin-block: var(--spacing-card-md) var(--spacing-card-sm);
// Same styling as h3
color: var(--color-text-dark);
font-size: 1.17em;
font-weight: bold;
.required {
color: var(--color-badge-red-bg);
}
}
.label__description {
display: block;
margin-block-end: var(--spacing-card-sm);
}
}
}
.padding-lg {
padding: var(--spacing-card-lg);
}
.padding-md {
padding: var(--spacing-card-md);
}
.padding-sm {
padding: var(--spacing-card-sm);
}
.padding-block-lg {
padding-block: var(--spacing-card-lg);
}
.padding-block-md {
padding-block: var(--spacing-card-md);
}
.padding-block-sm {
padding-block: var(--spacing-card-sm);
}
.padding-inline-lg {
padding-inline: var(--spacing-card-lg);
}
.padding-inline-md {
padding-inline: var(--spacing-card-md);
}
.padding-inline-sm {
padding-inline: var(--spacing-card-sm);
}
.universal-card {
@extend .base-card;
@extend .universal-labels;
.multiselect {
width: 15rem;
}
input + *, .input-group + * {
margin-block-start: var(--spacing-card-md);
}
button, .button, .iconified-button {
width: fit-content;
}
input {
box-sizing: border-box;
max-height: 40px;
width: 24rem;
flex-basis: 24rem;
&:not(.stylized-toggle) {
max-width: 100%;
}
}
.adjacent-input, &.adjacent-input {
display: flex;
flex-direction: row;
align-items: center;
.iconified-button, .input-group {
flex-shrink: 0;
}
input {
flex-shrink: 1;
}
> :first-child {
flex-shrink: 2;
flex-grow: 1;
margin-right: var(--spacing-card-md);
}
@media screen and (max-width: 750px) {
&:not(&.small) {
flex-direction: column;
align-items: start;
margin-bottom: var(--spacing-card-sm);
.stylized-toggle {
flex-basis: 0;
}
> :first-child {
margin-right: 0;
margin-bottom: var(--spacing-card-md);
}
}
}
}
h1 {
display: flex;
align-items: center;
}
> :first-child {
margin-block-start: 0;
}
> :last-child {
margin-block-end: 0;
}
}
.push-right {
margin-left: auto;
margin-right: 0;
}
input,
button {
&:disabled {
cursor: not-allowed !important;
}
}
.header-card {
@extend .universal-card;
.header__row {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
gap: var(--spacing-card-sm);
* {
flex-shrink: 0;
}
.header__title {
margin: 0;
flex-grow: 1;
}
&:not(:last-child) {
margin-bottom: var(--spacing-card-md);
}
}
}
.legacy-label-styles {
label {
display: flex;
flex-direction: column;
margin-bottom: 0.5rem;
&.no-margin {
margin-bottom: 0;
}
@media screen and (min-width: 1024px) {
flex-direction: row;
align-items: center;
}
> span {
flex: 2;
padding-right: var(--spacing-card-lg);
&.no-padding {
padding-right: 0;
}
}
> input,
> .multiselect,
> .input-group {
flex: 3;
height: fit-content;
}
> input[type='button'] {
height: fit-content;
flex: 1;
}
> input[type='button']:hover {
cursor: pointer;
}
> div,
> a {
height: fit-content;
flex: 1;
}
> div:hover {
cursor: pointer;
}
}
}
.input-group {
display: flex;
flex-direction: row;
grid-gap: var(--spacing-card-sm);
flex-wrap: wrap;
max-width: 100%;
align-items: center;
.multiselect {
width: 15rem;
}
input {
flex-shrink: 2;
}
}
.text-input-wrapper {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
background: var(--color-button-bg);
width: fit-content;
border-radius: var(--size-rounded-sm);
box-shadow: var(--shadow-inset-sm), 0 0 0 0 transparent;
transition: box-shadow 0.1s ease-in-out;
overflow: hidden;
max-width: 100%;
.text-input-wrapper__before {
display: flex;
color: var(--color-text);
padding: 0.5rem 0 0.5rem 1rem;
font-weight: var(--font-weight-medium);
min-height: 40px;
box-sizing: border-box;
width: fit-content;
align-items: center;
filter: grayscale(50%);
opacity: 0.5;
box-shadow: none;
flex-shrink: 0;
}
input, textarea {
border-radius: 0;
background-color: transparent;
box-shadow: unset;
padding-left: 0;
flex-grow: 1;
}
&:focus, &:focus-visible, &:focus-within {
box-shadow: inset 0 0 0 transparent, 0 0 0 .25rem var(--color-brand-shadow);
color: var(--color-button-text-active);
}
}