notification.pug 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //- to be kept in sync with frontend/js/shared/components/notification.tsx
  2. include ./material_symbol
  3. mixin notificationIcon(type)
  4. if type === 'info'
  5. +material-symbol('info')
  6. else if type === 'success'
  7. +material-symbol('check_circle')
  8. else if type === 'error'
  9. +material-symbol('error')
  10. else if type === 'warning'
  11. +material-symbol('warning')
  12. mixin notification(options)
  13. - var {ariaLive, id, type, title, content, disclaimer, className} = options
  14. - var classNames = `notification notification-type-${type} ${className ? className : ''} ${isActionBelowContent ? 'notification-cta-below-content' : ''}`
  15. div(aria-live=ariaLive role='alert' id=id class=classNames)
  16. .notification-icon
  17. +notificationIcon(type)
  18. .notification-content-and-cta
  19. .notification-content
  20. if title
  21. p
  22. b #{title}
  23. | !{content}
  24. block
  25. //- TODO: handle action
  26. //- if action
  27. //- .notification-cta
  28. if disclaimer
  29. .notification-disclaimer #{disclaimer}
  30. //- TODO: handle dismissible notifications
  31. //- TODO: handle onDismiss
  32. //- if isDismissible
  33. //- .notification-close-btn
  34. //- button(aria-label=translate('close'))
  35. //- +material-symbol("close")