feat(editor): dialog close button is a 44 px touch box
This commit is contained in:
1 parent
ae02f48853
commit
240c2ba0e7
4 files changed
+79
-5
No files matched your search
@@ -17,7 +17,11 @@ const lang: Locale =
|
||||
useLocaleStore.setState({ locale: lang })
|
||||
document.documentElement.lang = lang
|
||||
|
||||
type Scenario = 'basic' | 'long' | 'guarded' | 'vanishing' | null
|
||||
/** Wraps on a phone: the close button must keep its 44 px box beside it. */
|
||||
const LONG_TITLE =
|
||||
'A dialog title long enough to wrap over several lines on a narrow phone screen'
|
||||
|
||||
type Scenario = 'basic' | 'long' | 'title' | 'guarded' | 'vanishing' | null
|
||||
|
||||
function Background({ onOpen }: { onOpen: (scenario: Scenario) => void }) {
|
||||
const [clicks, setClicks] = useState(0)
|
||||
@@ -26,6 +30,7 @@ function Background({ onOpen }: { onOpen: (scenario: Scenario) => void }) {
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Button onClick={() => onOpen('basic')}>Open basic</Button>
|
||||
<Button onClick={() => onOpen('long')}>Open long</Button>
|
||||
<Button onClick={() => onOpen('title')}>Open wrapped title</Button>
|
||||
<Button onClick={() => onOpen('guarded')}>Open guarded</Button>
|
||||
</div>
|
||||
<Button variant="secondary" onClick={() => setClicks((n) => n + 1)}>
|
||||
@@ -88,6 +93,10 @@ function Harness() {
|
||||
<Button onClick={close}>End of content</Button>
|
||||
</Dialog>
|
||||
|
||||
<Dialog open={scenario === 'title'} onClose={close} title={LONG_TITLE}>
|
||||
<Button onClick={close}>Done</Button>
|
||||
</Dialog>
|
||||
|
||||
<Dialog
|
||||
open={scenario === 'guarded'}
|
||||
onClose={() => !busy && close()}
|
||||
|
||||
Reference in new issue
Block a user