2021-10-06 04:33:24 -04:00
|
|
|
import { useState } from 'react'
|
|
|
|
import useFetchMock from './hooks/use-fetch-mock'
|
|
|
|
import ContactUsModal from '../../modules/support/frontend/js/components/contact-us-modal'
|
2022-05-16 05:38:20 -04:00
|
|
|
import { ScopeDecorator } from './decorators/scope'
|
2021-10-06 04:33:24 -04:00
|
|
|
|
|
|
|
export const Generic = () => {
|
|
|
|
const [show, setShow] = useState(true)
|
2022-05-16 05:38:20 -04:00
|
|
|
|
2021-10-06 04:33:24 -04:00
|
|
|
const handleHide = () => setShow(false)
|
|
|
|
|
|
|
|
useFetchMock(fetchMock => {
|
2022-05-16 05:38:20 -04:00
|
|
|
fetchMock.post('/support', { status: 200 }, { delay: 1000 })
|
2021-10-06 04:33:24 -04:00
|
|
|
})
|
|
|
|
|
2022-05-16 05:38:20 -04:00
|
|
|
return <ContactUsModal show={show} handleHide={handleHide} />
|
2021-10-06 04:33:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export const RequestError = args => {
|
|
|
|
useFetchMock(fetchMock => {
|
2022-05-16 05:38:20 -04:00
|
|
|
fetchMock.post('/support', { status: 404 }, { delay: 250 })
|
2021-10-06 04:33:24 -04:00
|
|
|
})
|
|
|
|
|
2022-05-16 05:38:20 -04:00
|
|
|
return <ContactUsModal {...args} />
|
2021-10-06 04:33:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2022-03-28 06:23:21 -04:00
|
|
|
title: 'Shared / Modals / Contact Us',
|
2021-10-06 04:33:24 -04:00
|
|
|
component: ContactUsModal,
|
|
|
|
args: {
|
|
|
|
show: true,
|
|
|
|
handleHide: () => {},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
handleHide: { action: 'close modal' },
|
|
|
|
},
|
2022-05-16 05:38:20 -04:00
|
|
|
decorators: [ScopeDecorator],
|
2021-10-06 04:33:24 -04:00
|
|
|
}
|