naive-ui/styles/Card.scss
2019-12-08 20:47:14 +08:00

207 lines
5.4 KiB
SCSS

@import './mixins/mixins.scss';
$--card-margin-left: (
'small': 16px,
'medium': 24px,
'large': 32px,
'huge': 40px
);
$--card-margin-top: (
'small': 12px,
'medium': 16px,
'large': 20px,
'huge': 24px
);
$--card-margin-bottom: (
'small': 8px,
'medium': 12px,
'large': 16px,
'huge': 20px
);
@mixin card-size-mixin ($size) {
@include m($size + '-size') {
@include m(title-segmented) {
@include b(card-header) {
&:not(:last-child) {
margin-bottom: 0;
padding-bottom: map-get($--card-margin-bottom, $size);
}
}
}
@include m(title-soft-segmented) {
@include b(card-header) {
padding: map-get($--card-margin-top, $size) 0 map-get($--card-margin-bottom, $size) 0;
margin: 0 map-get($--card-margin-left, $size);
}
}
@include m(content-segmented) {
@include e(content) {
&:not(:last-child) {
margin-bottom: 0;
padding-bottom: map-get($--card-margin-bottom, $size);
}
}
}
@include m(content-soft-segmented) {
@include e(content) {
padding: 0;
margin: map-get($--card-margin-bottom, $size) map-get($--card-margin-left, $size);
&:not(:last-child) {
margin-bottom: 0;
padding-bottom: map-get($--card-margin-bottom, $size);
}
}
}
@include m(footer-segmented) {
@include e(footer) {
&:not(:last-child) {
margin-bottom: 0;
padding-bottom: map-get($--card-margin-bottom, $size);
}
}
}
@include m(footer-soft-segmented) {
@include e(footer) {
padding: 0;
margin: map-get($--card-margin-bottom, $size) map-get($--card-margin-left, $size);
&:not(:last-child) {
margin-bottom: 0;
padding-bottom: map-get($--card-margin-bottom, $size);
}
}
}
@include b(card-header) {
padding: 0px map-get($--card-margin-left, $size);
margin: map-get($--card-margin-top, $size) 0 map-get($--card-margin-bottom, $size) 0;
@include e(main) {
font-size: 18px;
}
@include e(extra) {
font-size: 14px;
}
}
@include e(content, footer) {
padding: 0px map-get($--card-margin-left, $size);
margin: map-get($--card-margin-bottom, $size) 0;
font-size: 14px;
}
@include e(action) {
background-color: $--card-action-background-color;
padding: map-get($--card-margin-bottom, $size) map-get($--card-margin-left, $size);
font-size: 14px;
}
}
}
@include themes-mixin {
@include b(card) {
@include once {
display: block;
overflow: hidden;
width: 100%;
box-sizing: border-box;
position: relative;
transition: color .3s $default-cubic-bezier, background-color .3s $default-cubic-bezier, border-color .3s $default-cubic-bezier;
border-radius: 6px;
@include card-size-mixin('small');
@include card-size-mixin('medium');
@include card-size-mixin('large');
@include card-size-mixin('huge');
@include b(card-cover) {
width: 100%;
img {
display: block;
width: 100%;
}
}
}
background-color: $--card-background-color;
color: $--card-text-color;
@include m(bordered) {
border: 1px solid $--card-border-color;
}
@include m(title-segmented, title-soft-segmented) {
@include b(card-header) {
@include once {
transition: border-color .3s $default-cubic-bezier;
}
&:not(:last-child) {
border-bottom: 1px solid $--card-border-color;
}
}
}
@include m(content-segmented, content-soft-segmented) {
@include e(content) {
@include once {
transition: border-color .3s $default-cubic-bezier;
}
&:not(:last-child) {
border-bottom: 1px solid $--card-border-color;
}
}
}
@include m(footer-segmented, footer-soft-segmented) {
@include e(footer) {
@include once {
transition: border-color .3s $default-cubic-bezier;
}
&:not(:last-child) {
border-bottom: 1px solid $--card-border-color;
}
}
}
@include b(card-header) {
@include once {
box-sizing: border-box;
display: flex;
align-items: center;
}
@include e(main) {
@include once {
font-weight: 700;
font-size: 18px;
transition: color .3s $default-cubic-bezier;
flex: 1;
}
color: $--card-title-text-color;
}
@include e(extra) {
@include once {
font-weight: 400;
font-size: 14px;
transition: color .3s $default-cubic-bezier;
}
color: $--card-text-color;
}
@include e(close-mark) {
@include once {
cursor: pointer;
transition: fill .3s $default-cubic-bezier
}
fill: $--card-close-fill;
}
}
@include once {
@include e(content) {
line-height: 1.5;
font-size: 14px;
}
@include e(footer) {
line-height: 1.5;
font-size: 14px;
}
}
@include e(action) {
@include once {
transition: background-color .3s $default-cubic-bezier;
line-height: 1.5;
font-size: 14px;
}
background-color: $--card-action-background-color;
}
}
}