Fix What's New dialog layout and improve dev styling/debugging.
Trigger cinny-mobile / dispatch (push) Successful in 1s
Trigger cinny-mobile / dispatch (push) Successful in 1s
Portal the updates dialog to document.body with stable data attributes, fix max-width (invalid S800 token), bundle update images for Capacitor, and add readable vanilla-extract class names plus portalContainer tap fixes.
This commit is contained in:
@@ -1,19 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Dialog,
|
||||
IconButton,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
OverlayCenter,
|
||||
Scroll,
|
||||
Spinner,
|
||||
Text,
|
||||
usePopOutContainer,
|
||||
} from 'folds';
|
||||
import { Box, Button, IconButton, Scroll, Spinner, Text } from 'folds';
|
||||
import { Icon, Icons } from '../icons';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import type { ParsedUpdateDoc, UpdateManifest } from '../../data/updateNotes';
|
||||
@@ -37,7 +25,6 @@ export function UpdatesDialog({
|
||||
onClose,
|
||||
}: UpdatesDialogProps) {
|
||||
const [showOlderList, setShowOlderList] = useState(false);
|
||||
const popOutContainer = usePopOutContainer();
|
||||
|
||||
const displayVersion = activeDoc?.version;
|
||||
const displayTitle = activeDoc?.title ?? (displayVersion ? `Version ${displayVersion}` : 'Release notes');
|
||||
@@ -49,29 +36,35 @@ export function UpdatesDialog({
|
||||
setShowOlderList(false);
|
||||
};
|
||||
|
||||
const portalTarget =
|
||||
popOutContainer ??
|
||||
document.getElementById('portalContainer') ??
|
||||
document.body;
|
||||
|
||||
return createPortal(
|
||||
<div className={css.PortalLayer}>
|
||||
<Overlay open backdrop={<OverlayBackdrop />}>
|
||||
<OverlayCenter className={css.OverlayFrame}>
|
||||
<FocusTrap
|
||||
focusTrapOptions={{
|
||||
initialFocus: false,
|
||||
clickOutsideDeactivates: false,
|
||||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
<div
|
||||
data-updates-dialog=""
|
||||
className={css.Root}
|
||||
data-disable-swipe-back="true"
|
||||
data-disable-swipe-reply="true"
|
||||
>
|
||||
<div data-updates-dialog-backdrop="" className={css.Backdrop} aria-hidden="true" />
|
||||
<div data-updates-dialog-frame="" className={css.Frame}>
|
||||
<FocusTrap
|
||||
focusTrapOptions={{
|
||||
initialFocus: false,
|
||||
clickOutsideDeactivates: false,
|
||||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="updates-dialog-title"
|
||||
data-updates-dialog-panel=""
|
||||
className={css.Panel}
|
||||
>
|
||||
<Dialog variant="Surface" className={css.DialogShell}>
|
||||
<Box className={css.Hero}>
|
||||
<Box className={css.HeroRow}>
|
||||
<img className={css.HeroLogo} src={PaarrotSVG} alt="" draggable={false} />
|
||||
<Box className={css.HeroTitleWrap}>
|
||||
<Text size="L400" priority="300">What's new</Text>
|
||||
<Text size="H4" truncate>
|
||||
<Text id="updates-dialog-title" size="H4" truncate>
|
||||
{displayVersion ? `Paarrot ${displayVersion}` : 'Paarrot updates'}
|
||||
</Text>
|
||||
</Box>
|
||||
@@ -181,11 +174,10 @@ export function UpdatesDialog({
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Dialog>
|
||||
</div>
|
||||
</FocusTrap>
|
||||
</OverlayCenter>
|
||||
</Overlay>
|
||||
</div>
|
||||
</div>,
|
||||
portalTarget
|
||||
document.body
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user