Fix Conflict modals and make scrollable
This commit is contained in:
parent
acadbc3eea
commit
0678856b43
4 changed files with 109 additions and 63 deletions
|
|
@ -30,6 +30,9 @@ const CharacterConflictModal = (props: Props) => {
|
||||||
// States
|
// States
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
|
// Refs
|
||||||
|
const footerRef = React.createRef<HTMLDivElement>()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOpen(props.open)
|
setOpen(props.open)
|
||||||
}, [setOpen, props.open])
|
}, [setOpen, props.open])
|
||||||
|
|
@ -73,9 +76,11 @@ const CharacterConflictModal = (props: Props) => {
|
||||||
<Dialog open={open} onOpenChange={openChange}>
|
<Dialog open={open} onOpenChange={openChange}>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
className="Conflict"
|
className="Conflict"
|
||||||
|
footerref={footerRef}
|
||||||
onOpenAutoFocus={(event) => event.preventDefault()}
|
onOpenAutoFocus={(event) => event.preventDefault()}
|
||||||
onEscapeKeyDown={close}
|
onEscapeKeyDown={close}
|
||||||
>
|
>
|
||||||
|
<div className="Content">
|
||||||
<p>
|
<p>
|
||||||
<Trans i18nKey="modals.conflict.character"></Trans>
|
<Trans i18nKey="modals.conflict.character"></Trans>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -102,13 +107,21 @@ const CharacterConflictModal = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
</div>
|
||||||
<Button onClick={close} text={t('buttons.cancel')} />
|
<div className="DialogFooter" ref={footerRef}>
|
||||||
|
<div className="Buttons Span">
|
||||||
<Button
|
<Button
|
||||||
|
contained={true}
|
||||||
|
onClick={close}
|
||||||
|
text={t('buttons.cancel')}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
contained={true}
|
||||||
onClick={props.resolveConflict}
|
onClick={props.resolveConflict}
|
||||||
text={t('modals.conflict.buttons.confirm')}
|
text={t('modals.conflict.buttons.confirm')}
|
||||||
/>
|
/>
|
||||||
</footer>
|
</div>
|
||||||
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<Overlay open={open} visible={true} />
|
<Overlay open={open} visible={true} />
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,19 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: ($unit * 1.5) ($unit * $multiplier) $unit-3x;
|
padding: ($unit * 1.5) ($unit * $multiplier) $unit-3x;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
|
|
||||||
|
.Buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: $unit;
|
||||||
|
|
||||||
|
&.Span {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.Button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
|
|
@ -160,9 +173,15 @@
|
||||||
&.Conflict {
|
&.Conflict {
|
||||||
$weapon-diameter: 14rem;
|
$weapon-diameter: 14rem;
|
||||||
|
|
||||||
|
.Content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: $unit-4x;
|
||||||
|
padding: $unit-4x $unit-4x $unit-2x $unit-4x;
|
||||||
|
|
||||||
& > p {
|
& > p {
|
||||||
line-height: 1.2;
|
font-size: $font-regular;
|
||||||
max-width: 400px;
|
line-height: 1.4;
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
font-weight: $bold;
|
font-weight: $bold;
|
||||||
|
|
@ -172,6 +191,7 @@
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.weapon,
|
.weapon,
|
||||||
.character {
|
.character {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ interface Props
|
||||||
React.DialogHTMLAttributes<HTMLDivElement>,
|
React.DialogHTMLAttributes<HTMLDivElement>,
|
||||||
HTMLDivElement
|
HTMLDivElement
|
||||||
> {
|
> {
|
||||||
headerref: React.RefObject<HTMLDivElement>
|
headerref?: React.RefObject<HTMLDivElement>
|
||||||
footerref?: React.RefObject<HTMLDivElement>
|
footerref?: React.RefObject<HTMLDivElement>
|
||||||
onEscapeKeyDown: (event: KeyboardEvent) => void
|
onEscapeKeyDown: (event: KeyboardEvent) => void
|
||||||
onOpenAutoFocus: (event: Event) => void
|
onOpenAutoFocus: (event: Event) => void
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@ const WeaponConflictModal = (props: Props) => {
|
||||||
// States
|
// States
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
|
// Refs
|
||||||
|
const footerRef = React.createRef<HTMLDivElement>()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOpen(props.open)
|
setOpen(props.open)
|
||||||
}, [setOpen, props.open])
|
}, [setOpen, props.open])
|
||||||
|
|
@ -67,9 +70,11 @@ const WeaponConflictModal = (props: Props) => {
|
||||||
<Dialog open={open} onOpenChange={openChange}>
|
<Dialog open={open} onOpenChange={openChange}>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
className="Conflict"
|
className="Conflict"
|
||||||
|
footerref={footerRef}
|
||||||
onOpenAutoFocus={(event) => event.preventDefault()}
|
onOpenAutoFocus={(event) => event.preventDefault()}
|
||||||
onEscapeKeyDown={close}
|
onEscapeKeyDown={close}
|
||||||
>
|
>
|
||||||
|
<div className="Content">
|
||||||
<p>{infoString()}</p>
|
<p>{infoString()}</p>
|
||||||
<div className="WeaponDiagram Diagram">
|
<div className="WeaponDiagram Diagram">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
@ -94,13 +99,21 @@ const WeaponConflictModal = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
</div>
|
||||||
<Button onClick={close} text={t('buttons.cancel')} />
|
<div className="DialogFooter" ref={footerRef}>
|
||||||
|
<div className="Buttons Span">
|
||||||
<Button
|
<Button
|
||||||
|
contained={true}
|
||||||
|
onClick={close}
|
||||||
|
text={t('buttons.cancel')}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
contained={true}
|
||||||
onClick={props.resolveConflict}
|
onClick={props.resolveConflict}
|
||||||
text={t('modals.conflict.buttons.confirm')}
|
text={t('modals.conflict.buttons.confirm')}
|
||||||
/>
|
/>
|
||||||
</footer>
|
</div>
|
||||||
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<Overlay open={open} visible={true} />
|
<Overlay open={open} visible={true} />
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue