11import { Notice , type NoticeProps } from "../dist/Notice" ;
22import { sectionName } from "./sectionName" ;
33import { getStoryFactory , logCallbacks } from "./getStory" ;
4+ import { Equals } from "tsafe/Equals" ;
5+ import { assert } from "tsafe/assert" ;
46
57const { meta, getStory } = getStoryFactory < NoticeProps > ( {
68 sectionName,
@@ -13,6 +15,38 @@ const { meta, getStory } = getStoryFactory<NoticeProps>({
1315 "description" :
1416 'Required message to display, it should not relay a "classic" information, but an important and temporary information.'
1517 } ,
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+ } ,
1650 "isClosable" : {
1751 "description" : "If the notice should have a close button"
1852 } ,
@@ -34,17 +68,88 @@ const { meta, getStory } = getStoryFactory<NoticeProps>({
3468export default meta ;
3569
3670export 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+ } ,
3879 "isClosable" : true ,
3980 "isClosed" : undefined ,
81+ "severity" : "info" ,
82+ "iconDisplayed" : true ,
4083 ...logCallbacks ( [ "onClose" ] )
4184} ) ;
4285
4386export const NonClosableNotice = getStory ( {
44- "title" : "This is the title"
87+ "title" : "This is the title" ,
88+ "description" : "This is the description."
4589} ) ;
4690
4791export const ClosableNotice = getStory ( {
48- "title" : "This is the title" ,
92+ "title" : "This is the title." ,
93+ "description" : "This is the description." ,
4994 "isClosable" : true
5095} ) ;
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