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:
Jessica Lawshe 2024-09-03 09:04:23 -05:00 committed by Copybot
parent 4f37ef0b1a
commit 8aa544a5ae
3 changed files with 45 additions and 3 deletions

View 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

View file

@ -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(

View file

@ -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'