77This component is made to display additional information to the user. It is
88available in four versions:
99
10- - success: Display a successful message
11- - info: Display an informational message
12- - warning: Display a warning to the user. This indicate that the action they want
13- - error: Display an error message. For example
14-
15- When using an error type,
10+ - **success**: Display a successful message.<br>
11+ Should be used to show success of an operation or optional information to help a user be more successful.
12+ - **info**: Display an informational message.<br>
13+ Should be used to highlight information that users should take into account.
14+ - **warning**: Display a warning to the user.<br>
15+ Should be used for critical content demanding user attention due to potential risks.
16+ - **error**: Display an error message.<br>
17+ Should be used for negative potential consequences of an action.
1618
1719```vue
1820<template>
@@ -63,12 +65,13 @@ When using an error type,
6365 <component :is =" icon"
6466 class =" notecard__icon"
6567 :class =" {'notecard__icon--heading': heading}"
66- :fill-color =" color" />
68+ :fill-color =" color"
69+ :size =" 20" />
6770 </slot >
6871 <div >
69- <h2 v-if =" heading" >
72+ <p v-if =" heading" class = " notecard__heading " >
7073 {{ heading }}
71- </h2 >
74+ </p >
7275 <slot />
7376 </div >
7477 </div >
@@ -85,17 +88,26 @@ export default {
8588
8689 props: {
8790 /**
88- * Type of the attribute
91+ * Type or severity of the message
8992 */
9093 type: {
9194 type: String ,
9295 default: ' warning' ,
9396 validator : type => [' success' , ' info' , ' warning' , ' error' ].includes (type),
9497 },
98+ /**
99+ * Enforce the `alert` role on the note card.
100+ *
101+ * The [`alert` role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
102+ * should only be used for information that requires the user's immediate attention.
103+ */
95104 showAlert: {
96105 type: Boolean ,
97106 default: false ,
98107 },
108+ /**
109+ * Optional text to show as a heading of the note card
110+ */
99111 heading: {
100112 type: String ,
101113 default: ' ' ,
@@ -139,20 +151,27 @@ export default {
139151
140152<style lang="scss" scoped>
141153.notecard {
154+ --note-card-padding : calc (2 * var (--default-grid-baseline ));
142155 color : var (--color-main-text ) !important ;
143156 background-color : var (--note-background ) !important ;
144- border-inline-start : 4 px solid var (--note-theme );
157+ border-inline-start : var ( --default-grid-baseline ) solid var (--note-theme );
145158 border-radius : var (--border-radius );
146- margin : 1rem 0 ;
147- margin-top : 1rem ;
148- padding : 1rem ;
159+ margin : 1 lh 0 ;
160+ padding : var (--note-card-padding );
149161 display : flex ;
150162 flex-direction : row ;
151- gap : 1rem ;
163+ gap : var (--note-card-padding );
164+
165+ & __heading {
166+ font-weight : 600 ;
167+ font-size : 20px ; // Same as icon
168+ }
152169
153- & __icon--heading {
154- margin-bottom : auto ;
155- margin-top : 0.3rem ;
170+ & __icon {
171+ & --heading {
172+ // 20px heading font size * 1.5 line height = 30px. 30px - 20px icon size = 10px. 10px / 2 for alignment
173+ margin-block : 5px auto ;
174+ }
156175 }
157176
158177 & --success {
0 commit comments