mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #20187 from overleaf/jel-plans-modal-edu-discount
[web] Use notification for when edu discount is applied or not on light touch redesign GitOrigin-RevId: 38278ac94f5b3cae18a500b3801412ed1b9a7da0
This commit is contained in:
parent
4f37ef0b1a
commit
8aa544a5ae
3 changed files with 45 additions and 3 deletions
38
services/web/app/views/_mixins/notification.pug
Normal file
38
services/web/app/views/_mixins/notification.pug
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
//- to be kept in sync with frontend/js/shared/components/notification.tsx
|
||||||
|
|
||||||
|
mixin notificationIcon(type)
|
||||||
|
if type === 'info'
|
||||||
|
span.material-symbols(aria-hidden="true") info
|
||||||
|
else if type === 'success'
|
||||||
|
span.material-symbols(aria-hidden="true") check_circle
|
||||||
|
|
||||||
|
|
||||||
|
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'))
|
||||||
|
//- span.material-symbols(aria-hidden="true") close
|
|
@ -1,3 +1,5 @@
|
||||||
|
include ../../../_mixins/notification
|
||||||
|
|
||||||
div.modal.fade.group-customize-subscription-modal.website-redesign-modal(tabindex="-1" role="dialog" data-ol-group-plan-modal)
|
div.modal.fade.group-customize-subscription-modal.website-redesign-modal(tabindex="-1" role="dialog" data-ol-group-plan-modal)
|
||||||
.modal-dialog(role="document")
|
.modal-dialog(role="document")
|
||||||
.modal-content
|
.modal-content
|
||||||
|
@ -92,13 +94,13 @@ div.modal.fade.group-customize-subscription-modal.website-redesign-modal(tabinde
|
||||||
span #{translate('educational_discount_disclaimer')}
|
span #{translate('educational_discount_disclaimer')}
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12.text-center
|
.col-md-12
|
||||||
.educational-discount-section
|
.educational-discount-section
|
||||||
div(hidden=(groupPlanModalDefaults.usage !== 'educational') data-ol-group-plan-educational-discount)
|
div(hidden=(groupPlanModalDefaults.usage !== 'educational') data-ol-group-plan-educational-discount)
|
||||||
.applied(hidden=true data-ol-group-plan-educational-discount-applied)
|
.applied(hidden=true data-ol-group-plan-educational-discount-applied)
|
||||||
| #{translate('educational_discount_applied')}
|
+notification({ariaLive: 'polite', content: translate('educational_discount_applied'), type: 'success', ariaLive: 'polite'})
|
||||||
.ineligible(hidden=true data-ol-group-plan-educational-discount-ineligible)
|
.ineligible(hidden=true data-ol-group-plan-educational-discount-ineligible)
|
||||||
| #{translate('educational_discount_available_for_groups_of_ten_or_more')}
|
+notification({ariaLive: 'polite', content: translate('educational_discount_available_for_groups_of_ten_or_more'), type: 'info', ariaLive: 'polite'})
|
||||||
.modal-footer
|
.modal-footer
|
||||||
.text-center
|
.text-center
|
||||||
button.btn.btn-primary.btn-lg(
|
button.btn.btn-primary.btn-lg(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// to be kept in sync with app/views/_mixins/notification.pug
|
||||||
|
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import React, { ReactElement, useState } from 'react'
|
import React, { ReactElement, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
Loading…
Reference in a new issue