File tree Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Original file line number Diff line number Diff line change 1+ import { styled , keyframes } from 'goober' ;
2+
3+ const circleAnimation = keyframes `
4+ from {
5+ transform: scale(0);
6+ opacity: 0;
7+ }
8+ to {
9+ transform: scale(1);
10+ opacity: 1;
11+ }` ;
12+
13+ const lineAnimation = keyframes `
14+ from {
15+ transform: translateX(-50%) scale(0);
16+ opacity: 0;
17+ height: 0;
18+ }
19+ to {
20+ transform: translateX(-50%) scale(1);
21+ opacity: 1;
22+ height: 8px;
23+ }` ;
24+
25+ const dotAnimation = keyframes `
26+ from {
27+ transform: translateX(-50%) scale(0);
28+ opacity: 0;
29+ height: 0;
30+ }
31+ to {
32+ transform: translateX(-50%) scale(1);
33+ opacity: 1;
34+ height: 2px;
35+ }` ;
36+
37+ export interface WarnTheme {
38+ primary ?: string ;
39+ secondary ?: string ;
40+ }
41+
42+ export const WarnIcon = styled ( 'div' ) < WarnTheme > `
43+ width: 20px;
44+ opacity: 0;
45+ height: 20px;
46+ border-radius: 50%;
47+ background: ${ ( p ) => p . primary || '#ffd00e' } ;
48+ position: relative;
49+
50+ animation: ${ circleAnimation } 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
51+ forwards;
52+ animation-delay: 100ms;
53+
54+ &:before,
55+ &:after {
56+ content: '';
57+ box-sizing: border-box;
58+ animation-delay: 200ms;
59+ position: absolute;
60+ display: block;
61+ transform: translateX(-50%);
62+ left: 50%;
63+ border: solid ${ ( p ) => p . secondary || '#000' } ;
64+ border-width: 0 2px 0 0;
65+ width: 2px;
66+ opacity: 0;
67+ }
68+
69+ &:before {
70+ top: 4px;
71+ animation: ${ lineAnimation } 0.2s ease-out forwards;
72+ animation-delay: 150ms;
73+ border-radius: 3px;
74+ }
75+
76+ &:after {
77+ bottom: 4px;
78+ animation: ${ dotAnimation } 0.2s ease-out forwards;
79+ animation-delay: 180ms;
80+ border-radius: 50%;
81+ }
82+ ` ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export { useStore as useToasterStore } from './core/store';
2121export { CheckmarkIcon } from './components/checkmark' ;
2222export { ErrorIcon } from './components/error' ;
2323export { LoaderIcon } from './components/loader' ;
24+ export { WarnIcon } from './components/warn' ;
2425export { resolveValue } from './core/types' ;
2526
2627export type ToastOptions = _ToastOptions ;
You can’t perform that action at this time.
0 commit comments