element-plus/packages/theme-chalk/src/notification.scss
云游君 3d1b3d4a58
refactor(theme-chalk): scss css var namespace (#7344)
* refactor(theme-chalk): scss css var namespace

* fix(theme-chalk): compile getCssVar

* fix(theme-chalk): more --el namespace replace & getCssVarWithDefault

* fix(theme-chalk): use cssVarBlockName & cssVar rewrite button css vars

* fix(theme-chalk): replace empty svg fill color with ns

* chore: use cssVarName for --el-color-white

* chore: fix namespace reactive

* chore: use defaultNamespace
2022-04-26 17:19:09 +08:00

106 lines
2.5 KiB
SCSS

@use 'mixins/mixins' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;
@include b(notification) {
@include set-component-css-var('notification', $notification);
}
@include b(notification) {
display: flex;
width: getCssVar('notification-width');
padding: getCssVar('notification-padding');
border-radius: getCssVar('notification-radius');
box-sizing: border-box;
border: 1px solid getCssVar('notification-border-color');
position: fixed;
background-color: getCssVar('bg-color', 'overlay');
box-shadow: getCssVar('notification-shadow');
transition: opacity getCssVar('transition-duration'),
transform getCssVar('transition-duration'),
left getCssVar('transition-duration'),
right getCssVar('transition-duration'), top 0.4s,
bottom getCssVar('transition-duration');
overflow-wrap: anywhere;
overflow: hidden;
z-index: 9999;
&.right {
right: 16px;
}
&.left {
left: 16px;
}
@include e(group) {
margin-left: getCssVar('notification-group-margin-left');
margin-right: getCssVar('notification-group-margin-right');
}
@include e(title) {
font-weight: bold;
font-size: getCssVar('notification-title-font-size');
line-height: getCssVar('notification-icon-size');
color: getCssVar('notification-title-color');
margin: 0;
}
@include e(content) {
font-size: getCssVar('notification-content-font-size');
line-height: 24px;
margin: 6px 0 0;
color: getCssVar('notification-content-color');
text-align: justify;
p {
margin: 0;
}
}
& .#{$namespace}-notification__icon {
height: getCssVar('notification-icon-size');
width: getCssVar('notification-icon-size');
font-size: getCssVar('notification-icon-size');
}
& .#{$namespace}-notification__closeBtn {
position: absolute;
top: 18px;
right: 15px;
cursor: pointer;
color: getCssVar('notification-close-color');
font-size: getCssVar('notification-close-font-size');
&:hover {
color: getCssVar('notification-close-hover-color');
}
}
@each $type in (success, info, warning, error) {
& .#{$namespace}-notification--#{$type} {
@include css-var-from-global(
('notification', 'icon-color'),
('color', $type)
);
color: getCssVar('notification-icon-color');
}
}
}
.#{$namespace}-notification-fade-enter-from {
&.right {
right: 0;
transform: translateX(100%);
}
&.left {
left: 0;
transform: translateX(-100%);
}
}
.#{$namespace}-notification-fade-leave-to {
opacity: 0;
}