Fix modal layout positioning
This commit is contained in:
parent
85e3945cd7
commit
807cd815ea
3 changed files with 7 additions and 5 deletions
|
@ -3,11 +3,13 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|||
import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';
|
||||
import { CSSTransition } from 'react-transition-group';
|
||||
import Spinner from '@/components/elements/Spinner';
|
||||
import classNames from 'classnames';
|
||||
|
||||
export interface RequiredModalProps {
|
||||
visible: boolean;
|
||||
onDismissed: () => void;
|
||||
appear?: boolean;
|
||||
top?: boolean;
|
||||
}
|
||||
|
||||
type Props = RequiredModalProps & {
|
||||
|
@ -18,7 +20,7 @@ type Props = RequiredModalProps & {
|
|||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default ({ visible, appear, dismissable, showSpinnerOverlay, closeOnBackground = true, closeOnEscape = true, onDismissed, children }: Props) => {
|
||||
export default ({ visible, appear, dismissable, showSpinnerOverlay, top = true, closeOnBackground = true, closeOnEscape = true, onDismissed, children }: Props) => {
|
||||
const [render, setRender] = useState(visible);
|
||||
|
||||
const isDismissable = useMemo(() => {
|
||||
|
@ -58,7 +60,7 @@ export default ({ visible, appear, dismissable, showSpinnerOverlay, closeOnBackg
|
|||
}
|
||||
}
|
||||
}}>
|
||||
<div className={'modal-container top'}>
|
||||
<div className={classNames('modal-container', { top })}>
|
||||
{isDismissable &&
|
||||
<div className={'modal-close-icon'} onClick={() => setRender(false)}>
|
||||
<FontAwesomeIcon icon={faTimes}/>
|
||||
|
|
|
@ -45,7 +45,7 @@ const EditSubuserModal = forwardRef<HTMLHeadingElement, Props>(({ subuser, ...pr
|
|||
const permissions = useStoreState((state: ApplicationStore) => state.permissions.data);
|
||||
|
||||
return (
|
||||
<Modal {...props} showSpinnerOverlay={isSubmitting}>
|
||||
<Modal {...props} top={false} showSpinnerOverlay={isSubmitting}>
|
||||
<h3 ref={ref}>
|
||||
{subuser ?
|
||||
`${canEditUser ? 'Modify' : 'View'} permissions for ${subuser.email}`
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
& > .modal-container {
|
||||
@apply .relative .w-full .max-w-1/2 .m-auto .flex-col .flex;
|
||||
|
||||
/*&.top {
|
||||
&.top {
|
||||
margin-top: 10%;
|
||||
}*/
|
||||
}
|
||||
|
||||
& > .modal-close-icon {
|
||||
@apply .absolute .pin-r .p-2 .text-white .cursor-pointer .opacity-50;
|
||||
|
|
Loading…
Reference in a new issue