1
1
import { Notice , type NoticeProps } from "../dist/Notice" ;
2
2
import { sectionName } from "./sectionName" ;
3
3
import { getStoryFactory , logCallbacks } from "./getStory" ;
4
+ import { Equals } from "tsafe/Equals" ;
5
+ import { assert } from "tsafe/assert" ;
4
6
5
7
const { meta, getStory } = getStoryFactory < NoticeProps > ( {
6
8
sectionName,
@@ -13,6 +15,38 @@ const { meta, getStory } = getStoryFactory<NoticeProps>({
13
15
"description" :
14
16
'Required message to display, it should not relay a "classic" information, but an important and temporary information.'
15
17
} ,
18
+ "description" : {
19
+ "description" : "Optional message to complete title"
20
+ } ,
21
+ "link" : {
22
+ "description" : "Optional link to display"
23
+ } ,
24
+ "severity" : {
25
+ "description" : 'Default : "info"' ,
26
+ "options" : ( ( ) => {
27
+ const severities = [
28
+ "info" ,
29
+ "warning" ,
30
+ "alert" ,
31
+ "weather-orange" ,
32
+ "weather-red" ,
33
+ "weather-purple" ,
34
+ "witness" ,
35
+ "kidnapping" ,
36
+ "attack" ,
37
+ "cyberattack"
38
+ ] as const ;
39
+
40
+ assert < Equals < typeof severities [ number ] | undefined , NoticeProps [ "severity" ] > > ( ) ;
41
+
42
+ return severities ;
43
+ } ) ( ) ,
44
+ "control" : { "type" : "radio" }
45
+ } ,
46
+ "iconDisplayed" : {
47
+ "description" :
48
+ "This option is possible if the notice is not a weather one or an alert one (witness, kidnapping, attack or cyberattack)."
49
+ } ,
16
50
"isClosable" : {
17
51
"description" : "If the notice should have a close button"
18
52
} ,
@@ -34,17 +68,88 @@ const { meta, getStory } = getStoryFactory<NoticeProps>({
34
68
export default meta ;
35
69
36
70
export const Default = getStory ( {
37
- "title" : "Service maintenance is scheduled today from 12:00 to 14:00" ,
71
+ "title" : "Service maintenance is scheduled today from 12:00 to 14:00." ,
72
+ "description" : "All will be ok after 14:00." ,
73
+ "link" : {
74
+ "linkProps" : {
75
+ "href" : "#"
76
+ } ,
77
+ "text" : "More information"
78
+ } ,
38
79
"isClosable" : true ,
39
80
"isClosed" : undefined ,
81
+ "severity" : "info" ,
82
+ "iconDisplayed" : true ,
40
83
...logCallbacks ( [ "onClose" ] )
41
84
} ) ;
42
85
43
86
export const NonClosableNotice = getStory ( {
44
- "title" : "This is the title"
87
+ "title" : "This is the title" ,
88
+ "description" : "This is the description."
45
89
} ) ;
46
90
47
91
export const ClosableNotice = getStory ( {
48
- "title" : "This is the title" ,
92
+ "title" : "This is the title." ,
93
+ "description" : "This is the description." ,
49
94
"isClosable" : true
50
95
} ) ;
96
+
97
+ export const InfoNotice = getStory ( {
98
+ "title" : "This is a Info notice." ,
99
+ "description" : "This is the description." ,
100
+ "severity" : "info"
101
+ } ) ;
102
+
103
+ export const WarningNotice = getStory ( {
104
+ "title" : "This is a Warning notice." ,
105
+ "description" : "This is the description." ,
106
+ "severity" : "warning"
107
+ } ) ;
108
+
109
+ export const AlertNotice = getStory ( {
110
+ "title" : "This is an Alert notice." ,
111
+ "description" : "This is the description." ,
112
+ "severity" : "alert"
113
+ } ) ;
114
+
115
+ export const WeatherOrangeNotice = getStory ( {
116
+ "title" : "This is a WeatherOrange notice." ,
117
+ "description" : "This is the description." ,
118
+ "severity" : "weather-orange"
119
+ } ) ;
120
+
121
+ export const WeatherRedNotice = getStory ( {
122
+ "title" : "This is a WeatherRed notice." ,
123
+ "description" : "This is the description." ,
124
+ "severity" : "weather-red"
125
+ } ) ;
126
+
127
+ export const WeatherPurpleNotice = getStory ( {
128
+ "title" : "This is a WeatherPurple notice." ,
129
+ "description" : "This is the description." ,
130
+ "severity" : "weather-purple"
131
+ } ) ;
132
+
133
+ export const WitnessNotice = getStory ( {
134
+ "title" : "This is a Witness notice." ,
135
+ "description" : "This is the description." ,
136
+ "severity" : "witness"
137
+ } ) ;
138
+
139
+ export const KidnappingNotice = getStory ( {
140
+ "title" : "This is a Kidnapping notice." ,
141
+ "description" : "This is the description." ,
142
+ "severity" : "kidnapping"
143
+ } ) ;
144
+
145
+ export const AttackNotice = getStory ( {
146
+ "title" : "This is an Attack notice." ,
147
+ "description" : "This is the description." ,
148
+ "severity" : "attack"
149
+ } ) ;
150
+
151
+ export const CyberattackNotice = getStory ( {
152
+ "title" : "This is a Cyberattack notice." ,
153
+ "description" : "This is the description." ,
154
+ "severity" : "cyberattack"
155
+ } ) ;
0 commit comments