notification.pug 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //- to be kept in sync with frontend/js/shared/components/notification.tsx
  2. mixin notificationIcon(type)
  3. if type === 'info'
  4. span.material-symbols(aria-hidden="true") info
  5. else if type === 'success'
  6. span.material-symbols(aria-hidden="true") check_circle
  7. mixin notification(options)
  8. - var {ariaLive, id, type, title, content, disclaimer, className} = options
  9. - var classNames = `notification notification-type-${type} ${className ? className : ''} ${isActionBelowContent ? 'notification-cta-below-content' : ''}`
  10. div(
  11. aria-live=ariaLive,
  12. role="alert",
  13. id=id,
  14. class=classNames
  15. )
  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. //- span.material-symbols(aria-hidden="true") close