mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
9997c4874f
* [web] Initialize BS5 in subscription page * [web] Update subscription-dashboard.tsx for BS5 * [web] Update row-link.tsx for BS5 * [web] Update modals * [web] Add `btn` to `btn-inline-link` classes * [web] Update circle change-to-group circle price element * [web] Replace `list-item-with-margin-bottom` with `mb-3` * [web] Update form elements to BS5 * [web] Use `useContactUsModal` * [web] Adjust tables margin/padding, and more * [web] Update change-to-group-modal.tsx * [web] Add gap to subscription buttons * [web] Remove subscription page colspan for md and above * [web] Use Notification component * [web] Update "leave group" buttons * [web] Fix tests: add `ol-user` meta tag * [web] Nest .hover-highlight in #subscription-dashboard-root * [web] Update to OLRow/OLCol * [web] Update to OLButtons * [web] Update to OLFormGroup * [web] Naming: use BSversion prefix * [web] Set CancelSubscriptionButton as ghost directly in component * [web] Set "Plan" font size * [web] Simplify cancel-subscription buttons * [web] Remove `--neutral-10` ModalFooter background * [web] Simplify circle styles * [web] Center discount badge * [web] Update fieldset label * [web] Add `<ul>` around RowLink * [web] Define SCSS for row-link component * [web] Remove some use of utility classes * [web] Revert and update `fieldset` changes (fixes tests) * [web] Fixup some more OLButtons * [web] Fixup use of OLRow/OLCol * [web] Reduce spacing below "legend-as-label" * [web] Use h5 instead of small in OLModalTitle * [web] Revert OLCol removal on lg screens I had removed them by mistake because I wasn't using the proper breakpoints * [web] Add backdrop to nested modal ContactUsModal * [web] Don't prefill project URL in ContactUsModal * [web] Fix lint * [web] Share `className` prop in BS5 and BS3 modals * [web] Set sub-title font sans serif (BS3) * [web] Update remaining Alerts to OLNotification GitOrigin-RevId: 7fd975ae3e992cebfaf71d4e182f8e13ec886d09
127 lines
3.4 KiB
TypeScript
127 lines
3.4 KiB
TypeScript
import {
|
|
Modal as BS5Modal,
|
|
ModalProps,
|
|
ModalHeaderProps,
|
|
ModalTitleProps,
|
|
ModalBody,
|
|
ModalFooterProps,
|
|
} from 'react-bootstrap-5'
|
|
import {
|
|
Modal as BS3Modal,
|
|
ModalProps as BS3ModalProps,
|
|
ModalHeaderProps as BS3ModalHeaderProps,
|
|
ModalTitleProps as BS3ModalTitleProps,
|
|
ModalBodyProps as BS3ModalBodyProps,
|
|
ModalFooterProps as BS3ModalFooterProps,
|
|
} from 'react-bootstrap'
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
import AccessibleModal from '@/shared/components/accessible-modal'
|
|
|
|
type OLModalProps = ModalProps & {
|
|
bs3Props?: Record<string, unknown>
|
|
size?: 'sm' | 'lg'
|
|
onHide: () => void
|
|
}
|
|
|
|
type OLModalHeaderProps = ModalHeaderProps & {
|
|
bs3Props?: Record<string, unknown>
|
|
}
|
|
|
|
type OLModalTitleProps = ModalTitleProps & {
|
|
bs3Props?: Record<string, unknown>
|
|
}
|
|
|
|
type OLModalBodyProps = React.ComponentProps<typeof ModalBody> & {
|
|
bs3Props?: Record<string, unknown>
|
|
}
|
|
|
|
type OLModalFooterProps = ModalFooterProps & {
|
|
bs3Props?: Record<string, unknown>
|
|
}
|
|
|
|
export default function OLModal({ children, ...props }: OLModalProps) {
|
|
const { bs3Props, ...bs5Props } = props
|
|
|
|
const bs3ModalProps: BS3ModalProps = {
|
|
bsClass: bs5Props.bsPrefix,
|
|
bsSize: bs5Props.size,
|
|
show: bs5Props.show,
|
|
onHide: bs5Props.onHide,
|
|
backdrop: bs5Props.backdrop,
|
|
animation: bs5Props.animation,
|
|
id: bs5Props.id,
|
|
className: bs5Props.className,
|
|
backdropClassName: bs5Props.backdropClassName,
|
|
...bs3Props,
|
|
}
|
|
|
|
return (
|
|
<BootstrapVersionSwitcher
|
|
bs3={<AccessibleModal {...bs3ModalProps}>{children}</AccessibleModal>}
|
|
bs5={<BS5Modal {...bs5Props}>{children}</BS5Modal>}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export function OLModalHeader({ children, ...props }: OLModalHeaderProps) {
|
|
const { bs3Props, ...bs5Props } = props
|
|
|
|
const bs3ModalProps: BS3ModalHeaderProps = {
|
|
bsClass: bs5Props.bsPrefix,
|
|
onHide: bs5Props.onHide,
|
|
closeButton: bs5Props.closeButton,
|
|
closeLabel: bs5Props.closeLabel,
|
|
}
|
|
return (
|
|
<BootstrapVersionSwitcher
|
|
bs3={<BS3Modal.Header {...bs3ModalProps}>{children}</BS3Modal.Header>}
|
|
bs5={<BS5Modal.Header {...bs5Props}>{children}</BS5Modal.Header>}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export function OLModalTitle({ children, ...props }: OLModalTitleProps) {
|
|
const { bs3Props, ...bs5Props } = props
|
|
|
|
const bs3ModalProps: BS3ModalTitleProps = {
|
|
componentClass: bs5Props.as,
|
|
}
|
|
return (
|
|
<BootstrapVersionSwitcher
|
|
bs3={<BS3Modal.Title {...bs3ModalProps}>{children}</BS3Modal.Title>}
|
|
bs5={<BS5Modal.Title {...bs5Props}>{children}</BS5Modal.Title>}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export function OLModalBody({ children, ...props }: OLModalBodyProps) {
|
|
const { bs3Props, ...bs5Props } = props
|
|
|
|
const bs3ModalProps: BS3ModalBodyProps = {
|
|
componentClass: bs5Props.as,
|
|
className: bs5Props.className,
|
|
}
|
|
|
|
return (
|
|
<BootstrapVersionSwitcher
|
|
bs3={<BS3Modal.Body {...bs3ModalProps}>{children}</BS3Modal.Body>}
|
|
bs5={<BS5Modal.Body {...bs5Props}>{children}</BS5Modal.Body>}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export function OLModalFooter({ children, ...props }: OLModalFooterProps) {
|
|
const { bs3Props, ...bs5Props } = props
|
|
|
|
const bs3ModalProps: BS3ModalFooterProps = {
|
|
componentClass: bs5Props.as,
|
|
className: bs5Props.className,
|
|
}
|
|
|
|
return (
|
|
<BootstrapVersionSwitcher
|
|
bs3={<BS3Modal.Footer {...bs3ModalProps}>{children}</BS3Modal.Footer>}
|
|
bs5={<BS5Modal.Footer {...bs5Props}>{children}</BS5Modal.Footer>}
|
|
/>
|
|
)
|
|
}
|