@difizen/mana-react
Version:
196 lines (159 loc) • 3.72 kB
text/less
@import '../../styles/variables.less';
@import './placement';
@notification-prefix-cls: ~'@{mana-prefix}-notification';
.@{notification-prefix-cls} {
position: fixed;
z-index: 100;
margin-right: 24px;
&-close-icon {
font-size: 14px;
cursor: pointer;
}
&-hook-holder {
position: relative;
}
&-notice {
position: relative;
width: 384px;
max-width: ~'calc(100vw - 24px * 2)';
margin-bottom: 16px;
margin-left: auto;
padding: 16px 18px 10px;
overflow: hidden;
line-height: 32px;
word-wrap: break-word;
background: var(--mana-color-bg-container);
border-radius: 8px;
box-shadow: 0 1px 6px rgba(0, 0, 0, 20%);
.@{notification-prefix-cls}-top &,
.@{notification-prefix-cls}-bottom & {
margin-right: auto;
margin-left: auto;
}
.@{notification-prefix-cls}-topLeft &,
.@{notification-prefix-cls}-bottomLeft & {
margin-right: auto;
margin-left: 0;
}
&-message {
margin-bottom: 8px;
color: var(--mana-text-color);
font-size: 16px;
line-height: 24px;
// https://github.com/ant-design/ant-design/issues/5846#issuecomment-296244140
&-single-line-auto-margin {
display: block;
width: ~'calc(384px - 8px * 2 - 24px - 48px - 100%)';
max-width: 4px;
background-color: transparent;
pointer-events: none;
&::before {
display: block;
content: '';
}
}
}
&-description {
font-size: 14px;
}
&-closable &-message {
padding-right: 24px;
}
&-with-icon &-message {
margin-bottom: 4px;
margin-left: 48px;
font-size: 16px;
}
&-with-icon &-description {
margin-left: 48px;
font-size: 14px;
}
// Icon & color style in different selector level
// https://github.com/ant-design/ant-design/issues/16503
// https://github.com/ant-design/ant-design/issues/15512
&-icon {
position: absolute;
margin-left: 4px;
font-size: 24px;
line-height: 24px;
}
.@{iconfont-css-prefix}&-icon {
&-success {
color: var(--mana-success-color);
}
&-info {
color: var(--mana-info-color);
}
&-warning {
color: var(--mana-warning-color);
}
&-error {
color: var(--mana-error-color);
}
}
&-close {
position: absolute;
top: 16px;
right: 22px;
color: var(--mana-text-secondary);
outline: none;
&:hover {
color: var(--mana-text-tertiary);
cursor: pointer;
}
}
&-btn {
float: right;
margin-top: 16px;
}
}
.notification-fade-effect {
animation-duration: 0.24s;
animation-timing-function: ease-in-out;
animation-fill-mode: both;
}
&-fade-enter,
&-fade-appear {
.notification-fade-effect();
opacity: 0;
animation-play-state: paused;
}
&-fade-leave {
.notification-fade-effect();
animation-duration: 0.2s;
animation-play-state: paused;
}
&-fade-enter&-fade-enter-active,
&-fade-appear&-fade-appear-active {
animation-name: notification-fade-in;
animation-play-state: running;
}
&-fade-leave&-fade-leave-active {
animation-name: notification-fade-out;
animation-play-state: running;
}
}
@keyframes notification-fade-in {
0% {
left: 384px;
opacity: 0;
}
100% {
left: 0;
opacity: 1;
}
}
@keyframes notification-fade-out {
0% {
max-height: 150px;
margin-bottom: 16px;
opacity: 1;
}
100% {
max-height: 0;
margin-bottom: 0;
padding-top: 0;
padding-bottom: 0;
opacity: 0;
}
}