naive-ui/styles/Card.scss

201 lines
5.2 KiB
SCSS
Raw Normal View History

@import './mixins/mixins.scss';
2019-11-13 00:02:42 +08:00
$--card-margin-left: (
'small': 16px,
2019-11-15 17:44:43 +08:00
'medium': 24px,
'large': 32px,
'huge': 40px
2019-11-13 00:02:42 +08:00
);
2019-11-13 00:02:42 +08:00
$--card-margin-top: (
'small': 12px,
2019-11-15 17:44:43 +08:00
'medium': 16px,
'large': 20px,
'huge': 24px
2019-11-13 00:02:42 +08:00
);
2019-11-13 00:02:42 +08:00
$--card-margin-bottom: (
2019-11-15 17:44:43 +08:00
'small': 8px,
'medium': 12px,
'large': 16px,
'huge': 20px
2019-11-13 00:02:42 +08:00
);
2019-11-13 00:02:42 +08:00
@mixin card-size-mixin ($size) {
@include m($size + '-size') {
@include m(content-segmented) {
2019-12-22 23:19:08 +08:00
& > {
@include e(content) {
&:not(:first-child) {
margin-top: 0;
padding-top: map-get($--card-margin-bottom, $size);
}
2019-11-13 00:02:42 +08:00
}
}
}
2019-11-15 17:44:43 +08:00
@include m(content-soft-segmented) {
2019-12-22 23:19:08 +08:00
& > {
@include e(content) {
padding: 0;
margin: map-get($--card-margin-bottom, $size) map-get($--card-margin-left, $size);
&:not(:first-child) {
margin-top: 0;
padding-top: map-get($--card-margin-bottom, $size);
}
2019-11-15 17:44:43 +08:00
}
}
}
2019-11-29 14:45:32 +08:00
@include m(footer-segmented) {
2019-12-22 23:19:08 +08:00
& > {
@include e(footer) {
&:not(:first-child) {
margin-top: 0;
padding-top: map-get($--card-margin-bottom, $size);
}
2019-11-13 00:02:42 +08:00
}
}
}
2019-11-29 14:45:32 +08:00
@include m(footer-soft-segmented) {
2019-12-22 23:19:08 +08:00
& > {
@include e(footer) {
padding: 0;
margin: map-get($--card-margin-bottom, $size) map-get($--card-margin-left, $size);
&:not(:first-child) {
margin-top: 0;
padding-top: map-get($--card-margin-bottom, $size);
}
2019-11-15 17:44:43 +08:00
}
}
}
2019-11-29 14:45:32 +08:00
@include b(card-header) {
2019-11-13 00:02:42 +08:00
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;
}
}
2019-11-29 14:45:32 +08:00
@include e(content, footer) {
2019-11-13 00:02:42 +08:00
padding: 0px map-get($--card-margin-left, $size);
margin: map-get($--card-margin-bottom, $size) 0;
font-size: 14px;
}
@include e(action) {
2019-11-29 14:45:32 +08:00
background-color: $--card-action-background-color;
2019-11-13 00:02:42 +08:00
padding: map-get($--card-margin-bottom, $size) map-get($--card-margin-left, $size);
font-size: 14px;
}
}
2019-11-13 00:02:42 +08:00
}
2019-11-13 00:02:42 +08:00
@include themes-mixin {
@include b(card) {
2019-11-29 14:45:32 +08:00
@include once {
display: block;
overflow: hidden;
2019-11-13 00:02:42 +08:00
width: 100%;
2019-11-29 14:45:32 +08:00
box-sizing: border-box;
position: relative;
transition: color .3s $--n-ease-in-out-cubic-bezier, background-color .3s $--n-ease-in-out-cubic-bezier, border-color .3s $--n-ease-in-out-cubic-bezier;
2019-11-29 14:45:32 +08:00
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) {
2019-11-13 00:02:42 +08:00
width: 100%;
2019-11-29 14:45:32 +08:00
img {
display: block;
width: 100%;
}
2019-11-13 00:02:42 +08:00
}
}
2019-11-29 14:45:32 +08:00
background-color: $--card-background-color;
color: $--card-text-color;
@include m(bordered) {
border: 1px solid $--card-border-color;
}
2019-12-22 23:19:08 +08:00
@include m(action-segmented) {
@include e(action) {
&:not(:first-child) {
border-top: 1px solid $--card-border-color;
2019-11-13 00:02:42 +08:00
}
}
}
2019-11-15 17:44:43 +08:00
@include m(content-segmented, content-soft-segmented) {
2019-11-13 00:02:42 +08:00
@include e(content) {
2019-11-29 14:45:32 +08:00
@include once {
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
2019-11-29 14:45:32 +08:00
}
2019-12-22 23:19:08 +08:00
&:not(:first-child) {
border-top: 1px solid $--card-border-color;
2019-11-13 00:02:42 +08:00
}
}
}
2019-11-29 14:45:32 +08:00
@include m(footer-segmented, footer-soft-segmented) {
@include e(footer) {
@include once {
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
2019-11-29 14:45:32 +08:00
}
2019-12-22 23:19:08 +08:00
&:not(:first-child) {
border-top: 1px solid $--card-border-color;
2019-11-13 00:02:42 +08:00
}
}
}
2019-11-29 14:45:32 +08:00
@include b(card-header) {
@include once {
box-sizing: border-box;
display: flex;
align-items: center;
}
2019-11-13 00:02:42 +08:00
@include e(main) {
2019-11-29 14:45:32 +08:00
@include once {
font-weight: 700;
font-size: 18px;
transition: color .3s $--n-ease-in-out-cubic-bezier;
2019-11-29 14:45:32 +08:00
flex: 1;
}
color: $--card-title-text-color;
2019-11-13 00:02:42 +08:00
}
@include e(extra) {
2019-11-29 14:45:32 +08:00
@include once {
font-weight: 400;
font-size: 14px;
transition: color .3s $--n-ease-in-out-cubic-bezier;
2019-11-29 14:45:32 +08:00
}
color: $--card-text-color;
2019-11-13 00:02:42 +08:00
}
2019-11-15 17:44:43 +08:00
@include e(close-mark) {
2019-11-29 14:45:32 +08:00
@include once {
cursor: pointer;
2019-12-22 23:19:08 +08:00
transition: fill .3s $--n-ease-in-out-cubic-bezier;
2019-11-29 14:45:32 +08:00
}
2019-12-08 20:47:14 +08:00
fill: $--card-close-fill;
2019-11-15 17:44:43 +08:00
}
2019-11-13 00:02:42 +08:00
}
2019-11-29 14:45:32 +08:00
@include once {
@include e(content) {
2019-12-22 23:19:08 +08:00
box-sizing: border-box;
2019-11-29 14:45:32 +08:00
line-height: 1.5;
font-size: 14px;
}
@include e(footer) {
2019-12-22 23:19:08 +08:00
box-sizing: border-box;
2019-11-29 14:45:32 +08:00
line-height: 1.5;
font-size: 14px;
}
2019-11-13 00:02:42 +08:00
}
@include e(action) {
2019-11-29 14:45:32 +08:00
@include once {
2019-12-22 23:19:08 +08:00
box-sizing: border-box;
transition: background-color .3s $--n-ease-in-out-cubic-bezier, border-color .3s $--n-ease-in-out-cubic-bezier;
2019-11-29 14:45:32 +08:00
line-height: 1.5;
font-size: 14px;
2019-12-22 23:19:08 +08:00
background-clip: padding-box;
2019-11-29 14:45:32 +08:00
}
background-color: $--card-action-background-color;
2019-11-13 00:02:42 +08:00
}
}
}