choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
311 lines (260 loc) • 7.01 kB
text/less
@import '../../style/themes/default';
@import '../../style/mixins/index';
@notification-prefix-cls: ~'@{c7n-prefix}-notification';
.@{notification-prefix-cls} {
.reset-component;
position: fixed;
z-index: @zindex-notification;
max-width: ~'calc(100vw - .32rem)';
margin-right: 0.24rem;
&-scroll {
overflow-x: hidden;
overflow-y: auto;
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-thumb {
background-color: rgba(45, 45, 45, .5);
border-radius: 8px;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}
}
&-before-shadow {
&::before {
position: absolute;
top: 0;
left: 0.12rem;
z-index: 1;
width: calc(100% - 0.32rem);
height: 0.57rem;
margin: 0;
background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.50) 0%, rgba(255, 255, 255, 1) 100%);
transform: scaleY(-1);
content: '';
}
}
&-after-shadow {
&::after {
position: absolute;
bottom: 0.35rem;
left: 0.12rem;
z-index: 1;
width: calc(100% - 0.32rem);
height: 0.57rem;
margin: 0;
background-image: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.50) 100%);
border-radius: 0.04rem;
transform: scaleY(-1);
content: '';
}
}
&-alert {
display: flex;
justify-content: space-between;
margin: 0 0.2rem 0.1rem 0.12rem;
padding: 0.08rem 0.16rem;
background-color: rgba(255, 255, 255, 1);
border: none;
border-radius: 0.04rem;
box-shadow: @shadow-2;
&-message {
color: @text-color-secondary;
}
&-close {
color: @link-color;
cursor: pointer;
&:hover {
color: @link-hover-color;
}
}
}
&-topLeft,
&-bottomLeft {
margin-right: 0;
margin-left: 0.24rem;
.@{notification-prefix-cls}-fade-enter.@{notification-prefix-cls}-fade-enter-active,
.@{notification-prefix-cls}-fade-appear.@{notification-prefix-cls}-fade-appear-active {
animation-name: NotificationLeftFadeIn;
}
}
&-notice {
position: relative;
width: @notification-width;
margin-bottom: @notification-margin-bottom;
padding: @notification-padding;
overflow: hidden;
line-height: 1.5;
background-color: @component-background;
border-radius: @border-radius-base;
box-shadow: @shadow-2;
transition: all @animation-duration-slow @ease-in-out;
&-content {
word-wrap: break-word;
}
&-message {
display: block;
margin-bottom: @notification-message-margin-bottom;
color: @heading-color;
font-size: @font-size-lg;
line-height: @notification-message-line-height;
&-single-line-auto-margin {
display: block;
width: ~'calc(@{notification-width} - @{notification-padding-horizontal} * 2 - .24rem - .48rem - 100%)';
max-width: 0.04rem;
background-color: transparent;
pointer-events: none;
&::before {
display: block;
content: '';
}
}
}
&-description {
color: @notification-description-color;
font-size: @font-size-base;
line-height: @notification-description-line-height;
}
&-closable &-message {
padding-right: @notification-closable-message-padding-right;
}
&-opacity {
transform: scale(0.98);
opacity: 0.7;
filter: blur(0.5px);
transition: all @animation-duration-slow @ease-in-out;
}
&-with-icon &-message {
margin-bottom: @notification-message-margin-bottom;
margin-left: @notification-with-icon-message-margin-left;
font-size: @font-size-lg;
}
&-with-icon &-description {
margin-left: @notification-with-icon-description-margin-left;
font-size: @font-size-base;
}
&-icon {
position: absolute;
top: @notification-icon-top;
left: @notification-icon-left;
margin-left: @notification-icon-margin-left;
line-height: 1;
// 功能提示框字体大小(提升 i 优先级以高于图标库默认样式)
i& {
font-size: @notification-icon-size;
}
// 自定义部分的字体行高
.@{iconfont-css-prefix} {
font-size: @notification-custom-icon-size;
}
// 自定义部分的字体行高
span& {
line-height: @notification-custom-notice-icon-line-height;
}
&-success {
color: @success-color;
}
&-info {
color: @info-color;
}
&-warning {
color: @warning-color;
}
&-error {
color: @error-color;
}
}
&-close-x::after {
font-size: @font-size-base;
font-family: anticon, sans-serif;
cursor: pointer;
content: '\e633';
}
&-close {
position: absolute;
top: @notification-close-icon-top;
right: @notification-close-icon-right;
color: @text-color-secondary;
outline: none;
a&:focus {
text-decoration: none;
}
&:hover {
color: #404040;
}
}
&-hide-shadow {
box-shadow: none;
transform: scale(0.98);
transition: all @animation-duration-slow @ease-in-out;
}
&-btn {
float: right;
margin-top: 0.16rem;
}
}
&-scroll &-notice {
margin-right: 0.12rem;
margin-left: 0.12rem;
}
.notification-fade-effect {
animation-duration: 0.24s;
animation-timing-function: @ease-in-out;
animation-fill-mode: both;
}
&-fade-enter,
&-fade-appear {
opacity: 0;
.notification-fade-effect();
animation-play-state: paused;
}
&-fade-leave {
.notification-fade-effect();
animation-duration: @animation-duration-base;
animation-play-state: paused;
}
&-fade-enter&-fade-enter-active,
&-fade-appear&-fade-appear-active {
animation-name: NotificationFadeIn;
animation-play-state: running;
}
&-fade-leave&-fade-leave-active {
animation-name: NotificationFadeOut;
animation-play-state: running;
}
}
@keyframes NotificationFadeIn {
0% {
left: @notification-width;
opacity: 0;
}
100% {
left: 0;
opacity: 1;
}
}
@keyframes NotificationLeftFadeIn {
0% {
right: @notification-width;
opacity: 0;
}
100% {
right: 0;
opacity: 1;
}
}
@keyframes NotificationFadeOut {
0% {
max-height: 1.5rem;
margin-bottom: @notification-margin-bottom;
padding-top: @notification-padding;
padding-bottom: @notification-padding;
opacity: 1;
}
100% {
max-height: 0;
margin-bottom: 0;
padding-top: 0;
padding-bottom: 0;
opacity: 0;
}
}