pocketbase/ui/src/scss/_base.scss

728 lines
14 KiB
SCSS
Raw Normal View History

2022-07-07 05:19:05 +08:00
@include scrollbar();
:focus-visible {
outline-color: var(--primaryColor);
outline-style: solid;
}
html,
body {
line-height: var(--baseLineHeight);
font-family: var(--baseFontFamily);
font-size: var(--baseFontSize);
color: var(--txtPrimaryColor);
background: var(--bodyColor);
}
#app {
overflow: auto;
display: block;
width: 100%;
height: 100vh;
}
%block {
display: block;
width: 100%;
}
// headings
%h {
margin: 0;
font-weight: normal;
}
h1, h2, h3, h4, h5, h6 {
@extend %h;
}
h1 {
font-size: 22px;
line-height: 28px;
}
h2 {
font-size: 20px;
line-height: 26px;
}
h3 {
font-size: 19px;
line-height: 24px;
}
h4 {
font-size: 18px;
line-height: 24px;
}
h5 {
font-size: 17px;
line-height: 24px;
}
h6 {
font-size: 16px;
line-height: 22px;
}
em {
font-style: italic;
}
2022-08-05 11:00:38 +08:00
ins {
2022-08-06 04:25:16 +08:00
color: var(--txtPrimaryColor);
2022-08-05 11:00:38 +08:00
background: var(--successAltColor);
text-decoration: none;
}
del {
2022-08-06 04:25:16 +08:00
color: var(--txtPrimaryColor);
2022-08-05 11:00:38 +08:00
background: var(--dangerAltColor);
text-decoration: none;
}
2022-07-07 05:19:05 +08:00
strong {
font-weight: 600;
}
small {
font-size: var(--smFontSize);
line-height: var(--smLineHeight);
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 1;
}
sup {
vertical-align: top;
}
sub {
vertical-align: bottom;
}
p {
@extend %block;
margin: 5px 0;
}
blockquote {
@extend %block;
position: relative;
padding-left: var(--smSpacing);
font-style: italic;
color: var(--txtHintColor);
&:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 2px;
height: 100%;
background: var(--baseColor);
}
}
code {
display: inline-block;
font-family: var(--monospaceFontFamily);
2022-10-30 16:28:14 +08:00
font-style: normal;
font-size: var(--lgFontSize);
2022-07-07 05:19:05 +08:00
line-height: 1.379rem;
padding: 0px 4px;
white-space: nowrap;
color: var(--txtPrimaryColor);
background: var(--baseAlt2Color);
border-radius: var(--baseRadius);
}
2022-08-06 04:25:16 +08:00
.code-block {
@extend %block;
overflow: auto;
padding: var(--xsSpacing);
white-space: pre-wrap;
background: var(--baseAlt1Color);
}
2022-07-07 05:19:05 +08:00
ol,
ul {
margin: 10px 0;
list-style: decimal;
padding-left: var(--baseSpacing);
li {
margin-top: 5px;
margin-bottom: 5px;
}
}
ul {
list-style: disc;
}
img {
max-width: 100%;
vertical-align: top;
}
hr {
display: block;
border: 0;
height: 1px;
width: 100%;
background: var(--baseAlt1Color);
margin: var(--baseSpacing) 0;
2022-10-30 16:28:14 +08:00
&.dark {
background: var(--baseAlt2Color);
}
2022-07-07 05:19:05 +08:00
}
a {
color: inherit;
&:hover {
text-decoration: none;
}
i, .txt {
display: inline-block;
vertical-align: top;
}
}
// text helpers
.txt-mono {
font-family: var(--monospaceFontFamily);
}
.txt-nowrap {
white-space: nowrap;
}
.txt-ellipsis {
display: inline-block;
vertical-align: top;
flex-shrink: 0;
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.txt-base {
font-size: var(--baseFontSize) !important;
}
.txt-xs {
font-size: var(--xsFontSize) !important;
line-height: var(--smLineHeight);
}
.txt-sm {
font-size: var(--smFontSize) !important;
line-height: var(--smLineHeight);
}
.txt-lg {
font-size: var(--lgFontSize) !important;
}
.txt-xl {
font-size: var(--xlFontSize) !important;
}
.txt-bold {
font-weight: 600 !important;
}
.txt-strikethrough {
text-decoration: line-through !important;
}
.txt-break {
white-space: pre-wrap !important;
}
.txt-center {
text-align: center !important;
}
2022-08-18 03:29:11 +08:00
.txt-justify {
text-align: justify !important;
}
2022-07-07 05:19:05 +08:00
.txt-left {
text-align: left !important;
}
.txt-right {
text-align: right !important;
}
.txt-main {
color: var(--txtPrimaryColor) !important;
}
.txt-hint {
color: var(--txtHintColor) !important;
}
.txt-disabled {
color: var(--txtDisabledColor) !important;
}
.link-hint {
user-select: none;
cursor: pointer;
color: var(--txtHintColor) !important;
text-decoration: none;
transition: color var(--baseAnimationSpeed);
&:hover,
&:focus-visible,
&:active {
color: var(--txtPrimaryColor) !important;
}
}
.link-fade {
opacity: 1;
user-select: none;
cursor: pointer;
text-decoration: none;
color: var(--txtPrimaryColor);
transition: opacity var(--baseAnimationSpeed);
&:focus-visible,
&:hover,
&:active {
opacity: 0.8;
}
}
// color helpers
@each $name, $color in $colorsMap {
.txt-#{$name} {
color: $color !important;
}
.bg-#{$name} {
background: $color !important;
}
.link-#{$name} {
cursor: pointer;
color: $color !important;
text-decoration: none;
user-select: none;
transition: opacity var(--baseAnimationSpeed);
2022-08-18 03:29:11 +08:00
&:focus-visible,
&:hover,
&:active {
2022-07-07 05:19:05 +08:00
opacity: 0.8;
}
}
}
.fade {
opacity: 0.6;
}
a,
.btn,
[tabindex],
[class*="link-"],
.handle {
&.fade {
transition: all var(--baseAnimationSpeed);
&:hover {
opacity: 1;
}
}
}
.noborder {
border: 0px !important;
}
.hidden {
display: none !important;
}
.hidden-empty {
&:empty {
display: none !important;
}
}
.block {
@extend %block;
}
.content {
@extend %block;
& > :first-child {
margin-top: 0;
}
& > :last-child {
margin-bottom: 0;
}
}
.panel {
@extend .content;
background: var(--baseColor);
border-radius: var(--lgRadius);
padding: calc(var(--baseSpacing) - 5px) var(--baseSpacing);
@include shadowize();
}
2022-10-30 16:28:14 +08:00
.sub-panel {
@extend .content;
background: var(--baseColor);
border-radius: var(--baseRadius);
padding: calc(var(--smSpacing) - 5px) var(--smSpacing);
border: 1px solid var(--baseAlt1Color);
}
2022-07-07 05:19:05 +08:00
.clearfix {
@extend %block;
clear: both;
&:after {
content: '';
display: table;
clear: both;
}
}
// flex helpers
.flex {
position: relative;
display: flex;
align-items: center;
width: 100%;
gap: var(--smSpacing);
}
.flex-fill {
flex: 1 1 auto !important;
}
.flex-wrap {
flex-wrap: wrap !important;
}
.flex-nowrap {
flex-wrap: nowrap !important;
}
.inline-flex {
position: relative;
display: inline-flex;
align-items: center;
flex-wrap: wrap;
min-width: 0;
gap: 10px;
}
@for $i from 0 through 6 {
.flex-order-#{$i} {
order: $i;
}
}
// flex gap helpers
@each $sizeAlias, $size in $sizesMap {
.flex-gap-#{$sizeAlias} {
gap: $size !important;
}
}
@for $i from 0 through 12 {
$spacing: 5 * $i;
.flex-gap-#{$spacing} {
gap: $spacing * 1px !important;
}
}
// spacing helpers
@each $sizeAlias, $size in $sizesMap {
.m-#{$sizeAlias} { margin: $size !important; }
.p-#{$sizeAlias} { padding: $size !important; }
}
@each $sideAlias, $side in $sidesMap {
.m-#{$sideAlias}-auto { margin-#{$side}: auto !important; }
.p-#{$sideAlias}-auto { padding-#{$side}: auto !important; }
@each $sizeAlias, $size in $sizesMap {
.m-#{$sideAlias}-#{$sizeAlias} { margin-#{$side}: $size !important; }
.p-#{$sideAlias}-#{$sizeAlias} { padding-#{$side}: $size !important; }
}
}
@for $i from 0 through 12 {
$spacing: 5 * $i;
.m-#{$spacing} { margin: $spacing * 1px !important; }
.p-#{$spacing} { padding: $spacing * 1px !important; }
@each $sideAlias, $side in $sidesMap {
.m-#{$sideAlias}-#{$spacing} { margin-#{$side}: $spacing * 1px !important; }
.p-#{$sideAlias}-#{$spacing} { padding-#{$side}: $spacing * 1px !important; }
}
}
.no-min-width {
min-width: 0 !important;
}
2022-07-07 05:19:05 +08:00
.wrapper {
position: relative;
width: var(--wrapperWidth);
margin: 0 auto;
max-width: 100%;
&.wrapper-sm {
width: var(--smWrapperWidth);
}
&.wrapper-lg {
width: var(--lgWrapperWidth);
}
}
.label {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 5px;
line-height: 1;
padding: 3px 8px;
min-height: 23px;
text-align: center;
font-size: var(--smFontSize);
border-radius: 30px;
background: var(--baseAlt2Color);
color: var(--txtPrimaryColor);
white-space: nowrap;
&.label-sm {
2022-08-10 18:22:27 +08:00
font-size: var(--xsFontSize);
padding: 3px 5px;
min-height: 18px;
line-height: 1;
}
2022-07-07 05:19:05 +08:00
&.label-primary {
color: var(--baseColor);
background: var(--primaryColor);
}
&.label-info {
background: var(--infoAltColor);
}
&.label-success {
background: var(--successAltColor);
}
&.label-danger {
background: var(--dangerAltColor);
}
&.label-warning {
background: var(--warningAltColor);
}
}
.thumb {
2023-01-11 04:20:52 +08:00
--thumbSize: 40px;
2022-07-07 05:19:05 +08:00
flex-shrink: 0;
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
width: var(--thumbSize);
height: var(--thumbSize);
background: var(--baseAlt2Color);
border-radius: var(--baseRadius);
color: var(--txtPrimaryColor);
2023-01-11 04:20:52 +08:00
font-size: 1.16rem;
2022-07-07 05:19:05 +08:00
@include shadowize();
i {
font-size: inherit;
}
img {
width: 100%;
height: 100%;
border-radius: inherit;
2022-08-01 19:20:21 +08:00
overflow: hidden;
2022-07-07 05:19:05 +08:00
}
&.thumb-sm {
--thumbSize: 32px;
2023-01-11 04:20:52 +08:00
font-size: 0.92rem;
2022-07-07 05:19:05 +08:00
}
&.thumb-lg {
--thumbSize: 60px;
font-size: 1.3rem;
}
&.thumb-xl {
--thumbSize: 80px;
font-size: 1.5rem;
}
&.thumb-circle {
border-radius: 50%;
}
&.thumb-active {
box-shadow: 0px 0px 0px 2px var(--primaryColor);
}
}
2023-01-11 04:20:52 +08:00
a.thumb:not(.thumb-active) {
transition: box-shadow var(--baseAnimationSpeed);
&:hover,
&:focus {
@include shadowize(0px 2px 4px 1px var(--shadowColor));
}
}
2022-07-07 05:19:05 +08:00
.section-title {
display: flex;
2022-08-10 18:22:27 +08:00
align-items: center;
2022-07-07 05:19:05 +08:00
width: 100%;
column-gap: 10px;
row-gap: 5px;
margin: 0 0 var(--xsSpacing);
font-weight: 600;
font-size: var(--smFontSize);
line-height: var(--smLineHeight);
color: var(--txtHintColor);
text-transform: uppercase;
}
.drag-handle {
outline: 0;
cursor: pointer;
display: inline-flex;
align-items: left;
color: var(--txtDisabledColor);
transition: color var(--baseAnimationSpeed);
&:before,
&:after {
content: '\ef77';
font-family: var(--iconFontFamily);
font-size: 18px;
line-height: 1;
width: 7px;
text-align: center;
}
&:focus-visible,
&:hover,
&:active {
color: var(--txtPrimaryColor);
}
}
.logo {
position: relative;
vertical-align: top;
display: inline-flex;
align-items: center;
gap: 10px;
font-size: 23px;
text-decoration: none;
color: inherit;
user-select: none;
strong {
font-weight: bold;
}
.version {
position: absolute;
right: 0;
top: -5px;
line-height: 1;
font-size: 10px;
font-weight: normal;
padding: 2px 4px;
border-radius: var(--baseRadius);
background: var(--dangerAltColor);
color: var(--txtPrimaryColor);
}
&.logo-sm {
font-size: 20px;
}
}
.loader {
--loaderSize: 32px;
position: relative;
display: inline-flex;
flex-direction: column;
align-items: center;
justify-content: center;
row-gap: 10px;
margin: 0;
color: var(--txtDisabledColor);
text-align: center;
font-weight: normal;
&:before {
content: "\eec4";
display: inline-block;
vertical-align: top;
clear: both;
width: var(--loaderSize);
height: var(--loaderSize);
line-height: var(--loaderSize);
font-size: var(--loaderSize);
font-weight: normal;
font-family: var(--iconFontFamily);
color: inherit;
text-align: center;
animation: loaderShow var(--baseAnimationSpeed),
rotate 0.9s var(--baseAnimationSpeed) infinite linear;
}
// styles
@each $name, $color in $colorsMap {
&.loader-#{$name} {
color: $color;
}
}
// sizes
&.loader-sm {
--loaderSize: 24px;
}
&.loader-lg {
--loaderSize: 42px;
}
}
.skeleton-loader {
@extend %block;
position: relative;
height: 12px;
margin: 5px 0;
border-radius: var(--baseRadius);
background: var(--baseAlt1Color);
animation: fadeIn 0.4s;
&:before {
content: "";
width: 100%;
height: 100%;
display: block;
border-radius: inherit;
background: linear-gradient(90deg, var(--baseAlt1Color) 8%, var(--bodyColor) 18%, var(--baseAlt1Color) 33%);
background-size: 200% 100%;
animation: shine 1s linear infinite;
}
}
.placeholder-section {
display: flex;
width: 100%;
align-items: center;
justify-content: center;
text-align: center;
flex-direction: column;
gap: var(--smSpacing);
color: var(--txtHintColor);
.icon {
$size: 50px;
font-size: $size;
height: $size;
line-height: 1;
opacity: 0.3;
i {
font-size: inherit;
vertical-align: top;
}
}
}
2022-08-06 04:25:16 +08:00
.list {
@extend %block;
position: relative;
2022-10-30 16:28:14 +08:00
border: 1px solid var(--baseAlt2Color);
2022-08-06 04:25:16 +08:00
border-radius: var(--baseRadius);
.list-item {
2022-08-06 13:03:34 +08:00
word-break: break-word;
2022-08-06 04:25:16 +08:00
position: relative;
display: flex;
align-items: center;
width: 100%;
gap: 10px;
padding: 10px;
2022-10-30 16:28:14 +08:00
border-bottom: 1px solid var(--baseAlt2Color);
2022-08-06 04:25:16 +08:00
&:last-child {
border-bottom: 0;
}
}
}
// base entrance animations
.entrance-top {
animation: entranceTop var(--entranceAnimationSpeed);
}
.entrance-bottom {
animation: entranceBottom var(--entranceAnimationSpeed);
}
.entrance-left {
animation: entranceLeft var(--entranceAnimationSpeed);
}
.entrance-right {
animation: entranceRight var(--entranceAnimationSpeed);
}