notification.pug 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. //- TODO: handle action
  25. //- if action
  26. //- .notification-cta
  27. if disclaimer
  28. .notification-disclaimer #{disclaimer}
  29. //- TODO: handle dismissible notifications
  30. //- TODO: handle onDismiss
  31. //- if isDismissible
  32. //- .notification-close-btn
  33. //- button(aria-label=translate('close'))
  34. //- +material-symbol("close")