overleaf-cep/services/web/app/views/_mixins/notification.pug
Rebeka Dekany c40ab3234d Prettier for PUG templates (#26170)
* Setup prettier

* Ignore these pug templates by prettier

* Fix typo

* Fix prettier error

* Add prettier-ignore for quoting of event-segmentation attribute

* Manual tab indentation

* Interpolate

* Remove unbuffered if conditional

* Inline event-segmentation objects and remove prettier-ignore rule

* Fix spacing before interpolation

* Source format

* Source format

GitOrigin-RevId: c30e037f5caf8f91efc1bd9e75f81ae533b5a506
2025-06-24 08:05:06 +00:00

37 lines
1.1 KiB
Text

//- to be kept in sync with frontend/js/shared/components/notification.tsx
include ./material_symbol
mixin notificationIcon(type)
if type === 'info'
+material-symbol('info')
else if type === 'success'
+material-symbol('check_circle')
else if type === 'error'
+material-symbol('error')
else if type === 'warning'
+material-symbol('warning')
mixin notification(options)
- var {ariaLive, id, type, title, content, disclaimer, className} = options
- var classNames = `notification notification-type-${type} ${className ? className : ''} ${isActionBelowContent ? 'notification-cta-below-content' : ''}`
div(aria-live=ariaLive role='alert' id=id class=classNames)
.notification-icon
+notificationIcon(type)
.notification-content-and-cta
.notification-content
if title
p
b #{title}
| !{content}
//- TODO: handle action
//- if action
//- .notification-cta
if disclaimer
.notification-disclaimer #{disclaimer}
//- TODO: handle dismissible notifications
//- TODO: handle onDismiss
//- if isDismissible
//- .notification-close-btn
//- button(aria-label=translate('close'))
//- +material-symbol("close")