Files
bulma/sass/components/card.scss
Jeremy Thomas b73e183091 Init dark theme
2022-12-14 17:15:51 +00:00

154 lines
3.9 KiB
SCSS

@import "../utilities/mixins";
$card-color: getVar("text") !default;
$card-background-color: getVar("scheme-main") !default;
$card-shadow: getVar("shadow") !default;
$card-radius: 0.25rem !default;
$card-header-background-color: transparent !default;
$card-header-color: getVar("text-strong") !default;
$card-header-padding: 0.75rem 1rem !default;
$card-header-shadow: 0 0.125em 0.25em rgba(getVar("shadow-color-rgb"), 0.1) !default; // TODO
$card-header-weight: getVar("weight-bold") !default;
$card-content-background-color: transparent !default;
$card-content-padding: 1.5rem !default;
$card-footer-background-color: transparent !default;
$card-footer-border-top: 1px solid getVar("border-light") !default;
$card-footer-padding: 0.75rem !default;
$card-media-margin: getVar("block-spacing") !default;
:root {
@include register-vars(
(
card-color: #{$card-color},
card-background-color: #{$card-background-color},
card-shadow: #{$card-shadow},
card-radius: #{$card-radius},
card-header-background-color: #{$card-header-background-color},
card-header-color: #{$card-header-color},
card-header-padding: #{$card-header-padding},
card-header-shadow: #{$card-header-shadow},
card-header-weight: #{$card-header-weight},
card-content-background-color: #{$card-content-background-color},
card-content-padding: #{$card-content-padding},
card-footer-background-color: #{$card-footer-background-color},
card-footer-border-top: #{$card-footer-border-top},
card-footer-padding: #{$card-footer-padding},
card-media-margin: #{$card-media-margin},
)
);
}
.#{$class-prefix}card {
background-color: getVar("card-background-color");
border-radius: getVar("card-radius");
box-shadow: getVar("card-shadow");
color: getVar("card-color");
max-width: 100%;
position: relative;
}
%card-item {
&:first-child {
border-top-left-radius: getVar("card-radius");
border-top-right-radius: getVar("card-radius");
}
&:last-child {
border-bottom-left-radius: getVar("card-radius");
border-bottom-right-radius: getVar("card-radius");
}
}
.#{$class-prefix}card-header {
@extend %card-item;
background-color: getVar("card-header-background-color");
align-items: stretch;
box-shadow: getVar("card-header-shadow");
display: flex;
}
.#{$class-prefix}card-header-title {
align-items: center;
color: getVar("card-header-color");
display: flex;
flex-grow: 1;
font-weight: getVar("card-header-weight");
padding: getVar("card-header-padding");
&.is-centered {
justify-content: center;
}
}
.#{$class-prefix}card-header-icon {
@include reset;
align-items: center;
cursor: pointer;
display: flex;
justify-content: center;
padding: getVar("card-header-padding");
}
.#{$class-prefix}card-image {
display: block;
position: relative;
&:first-child {
img {
border-top-left-radius: getVar("card-radius");
border-top-right-radius: getVar("card-radius");
}
}
&:last-child {
img {
border-bottom-left-radius: getVar("card-radius");
border-bottom-right-radius: getVar("card-radius");
}
}
}
.#{$class-prefix}card-content {
@extend %card-item;
background-color: getVar("card-content-background-color");
padding: getVar("card-content-padding");
}
.#{$class-prefix}card-footer {
@extend %card-item;
background-color: getVar("card-footer-background-color");
border-top: getVar("card-footer-border-top");
align-items: stretch;
display: flex;
}
.#{$class-prefix}card-footer-item {
align-items: center;
display: flex;
flex-basis: 0;
flex-grow: 1;
flex-shrink: 0;
justify-content: center;
padding: getVar("card-footer-padding");
&:not(:last-child) {
@include ltr-property("border", getVar("card-footer-border-top"));
}
}
// Combinations
.#{$class-prefix}card {
.#{$class-prefix}media:not(:last-child) {
margin-bottom: getVar("card-media-margin");
}
}