|
@@ -1,9 +1,10 @@
|
|
|
-import { ComponentProps } from 'react'
|
|
|
|
|
|
|
+import { ComponentProps, useCallback, useState } from 'react'
|
|
|
import useFetchMock from './hooks/use-fetch-mock'
|
|
import useFetchMock from './hooks/use-fetch-mock'
|
|
|
import ContactUsModal from '../../modules/support/frontend/js/components/contact-us-modal'
|
|
import ContactUsModal from '../../modules/support/frontend/js/components/contact-us-modal'
|
|
|
import fixedHelpSuggestionSearch from '../../modules/support/test/frontend/util/fixed-help-suggestion-search'
|
|
import fixedHelpSuggestionSearch from '../../modules/support/test/frontend/util/fixed-help-suggestion-search'
|
|
|
import { ScopeDecorator } from './decorators/scope'
|
|
import { ScopeDecorator } from './decorators/scope'
|
|
|
import { StoryObj } from '@storybook/react'
|
|
import { StoryObj } from '@storybook/react'
|
|
|
|
|
+import OLButton from '@/features/ui/components/ol/ol-button'
|
|
|
|
|
|
|
|
type Story = StoryObj<typeof ContactUsModal>
|
|
type Story = StoryObj<typeof ContactUsModal>
|
|
|
type ContactUsModalProps = ComponentProps<typeof ContactUsModal>
|
|
type ContactUsModalProps = ComponentProps<typeof ContactUsModal>
|
|
@@ -81,6 +82,46 @@ export const RequestErrorBootstrap5: Story = bootstrap5Story(
|
|
|
renderContactUsModalWithRequestError
|
|
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 {
|
|
export default {
|
|
|
title: 'Shared / Modals / Contact Us',
|
|
title: 'Shared / Modals / Contact Us',
|
|
|
component: ContactUsModal,
|
|
component: ContactUsModal,
|