mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-22 02:04:31 +00:00
Merge pull request #20169 from overleaf/td-contact-modal-acknowledge
Add acknowledgement message to React contact modal after successful submission GitOrigin-RevId: a27b968351857997df17fedde3baa9da3f82331a
This commit is contained in:
parent
4733eb1007
commit
e88b971735
4 changed files with 51 additions and 2 deletions
|
@ -867,6 +867,7 @@
|
|||
"mendeley_sync_description": "",
|
||||
"menu": "",
|
||||
"merge_cells": "",
|
||||
"message_received": "",
|
||||
"missing_field_for_entry": "",
|
||||
"missing_fields_for_entry": "",
|
||||
"money_back_guarantee": "",
|
||||
|
@ -1463,6 +1464,7 @@
|
|||
"thank_you_exclamation": "",
|
||||
"thank_you_for_your_feedback": "",
|
||||
"thanks_for_confirming_your_email_address": "",
|
||||
"thanks_for_getting_in_touch": "",
|
||||
"thanks_for_subscribing": "",
|
||||
"thanks_for_subscribing_you_help_sl": "",
|
||||
"thanks_settings_updated": "",
|
||||
|
|
|
@ -4,6 +4,7 @@ import type { ButtonProps } from '@/features/ui/components/types/button-props'
|
|||
import type { ButtonProps as BS3ButtonPropsBase } from 'react-bootstrap'
|
||||
import Button from '../bootstrap-5/button'
|
||||
import classnames from 'classnames'
|
||||
import { getAriaAndDataProps } from '@/features/utils/bootstrap-5'
|
||||
|
||||
export type BS3ButtonSize = 'xsmall' | 'sm' | 'medium' | 'lg'
|
||||
|
||||
|
@ -45,10 +46,13 @@ export const mapBsButtonSizes = (
|
|||
export default function OLButton(props: OLButtonProps) {
|
||||
const { bs3Props, ...rest } = props
|
||||
|
||||
// Get all `aria-*` and `data-*` attributes
|
||||
const extraProps = getAriaAndDataProps(rest)
|
||||
|
||||
return (
|
||||
<BootstrapVersionSwitcher
|
||||
bs3={
|
||||
<BS3Button {...bs3ButtonProps(rest)} {...bs3Props}>
|
||||
<BS3Button {...bs3ButtonProps(rest)} {...bs3Props} {...extraProps}>
|
||||
{bs3Props?.loading || rest.children}
|
||||
</BS3Button>
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { ComponentProps } from 'react'
|
||||
import { ComponentProps, useCallback, useState } from 'react'
|
||||
import useFetchMock from './hooks/use-fetch-mock'
|
||||
import ContactUsModal from '../../modules/support/frontend/js/components/contact-us-modal'
|
||||
import fixedHelpSuggestionSearch from '../../modules/support/test/frontend/util/fixed-help-suggestion-search'
|
||||
import { ScopeDecorator } from './decorators/scope'
|
||||
import { StoryObj } from '@storybook/react'
|
||||
import OLButton from '@/features/ui/components/ol/ol-button'
|
||||
|
||||
type Story = StoryObj<typeof ContactUsModal>
|
||||
type ContactUsModalProps = ComponentProps<typeof ContactUsModal>
|
||||
|
@ -81,6 +82,46 @@ export const RequestErrorBootstrap5: Story = bootstrap5Story(
|
|||
renderContactUsModalWithRequestError
|
||||
)
|
||||
|
||||
const ContactUsModalWithAcknowledgement = (
|
||||
args: Omit<ContactUsModalProps, 'show' | 'handleHide'>
|
||||
) => {
|
||||
useFetchMock(fetchMock => {
|
||||
fetchMock.post('/support', { status: 200 }, { delay: 1000 })
|
||||
})
|
||||
|
||||
const [show, setShow] = useState(false)
|
||||
|
||||
const hideModal = useCallback((event?: Event) => {
|
||||
event?.preventDefault()
|
||||
setShow(false)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<OLButton onClick={() => setShow(true)}>Contact Us</OLButton>
|
||||
<ContactUsModal
|
||||
show={show}
|
||||
handleHide={hideModal}
|
||||
helpSuggestionSearch={fixedHelpSuggestionSearch}
|
||||
{...args}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const renderContactUsModalWithAcknowledgement = (args: ContactUsModalProps) => {
|
||||
const { show, handleHide, ...rest } = args
|
||||
return <ContactUsModalWithAcknowledgement {...rest} />
|
||||
}
|
||||
|
||||
export const WithAcknowledgement: Story = bootstrap3Story(
|
||||
renderContactUsModalWithAcknowledgement
|
||||
)
|
||||
|
||||
export const WithAcknowledgementBootstrap5: Story = bootstrap5Story(
|
||||
renderContactUsModalWithAcknowledgement
|
||||
)
|
||||
|
||||
export default {
|
||||
title: 'Shared / Modals / Contact Us',
|
||||
component: ContactUsModal,
|
||||
|
|
|
@ -1228,6 +1228,7 @@
|
|||
"merge": "Merge",
|
||||
"merge_cells": "Merge cells",
|
||||
"merging": "Merging",
|
||||
"message_received": "Message received",
|
||||
"missing_field_for_entry": "Missing field for",
|
||||
"missing_fields_for_entry": "Missing fields for",
|
||||
"money_back_guarantee": "30-day money back guarantee, no questions asked",
|
||||
|
@ -2040,6 +2041,7 @@
|
|||
"thank_you_for_your_feedback": "Thank you for your feedback!",
|
||||
"thanks": "Thanks",
|
||||
"thanks_for_confirming_your_email_address": "Thanks for confirming your email address",
|
||||
"thanks_for_getting_in_touch": "Thanks for getting in touch. Our team will get back to you by email as soon as possible.",
|
||||
"thanks_for_subscribing": "Thanks for subscribing!",
|
||||
"thanks_for_subscribing_you_help_sl": "Thank you for subscribing to the __planName__ plan. It’s support from people like yourself that allows __appName__ to continue to grow and improve.",
|
||||
"thanks_settings_updated": "Thanks, your settings have been updated.",
|
||||
|
|
Loading…
Reference in a new issue