ui: replace invented modal with old-plugin style — MenuItem component + Modal (More menu)
This commit is contained in:
1 parent
0fdd6164ed
commit
b796eae1eb
2 files changed
+109
-16
No files matched your search
+21
-16
@@ -5,7 +5,6 @@ import {
|
||||
Muted,
|
||||
VerticalSpace,
|
||||
Divider,
|
||||
Button,
|
||||
Stack,
|
||||
Modal,
|
||||
IconButton,
|
||||
@@ -18,6 +17,7 @@ import {
|
||||
import { emit, on } from '@create-figma-plugin/utilities'
|
||||
import { h, Fragment } from 'preact'
|
||||
import { useState, useEffect, useRef } from 'preact/hooks'
|
||||
import MenuItem from './MenuItem'
|
||||
|
||||
const MIN_WINDOW_SIZE = { width: 320, height: 200 }
|
||||
// No static max: "maximize" targets the whole viewport (maxViewport from main),
|
||||
@@ -353,22 +353,27 @@ function Plugin () {
|
||||
<VerticalSpace space="small" />
|
||||
<Muted style={{ fontSize: '11px' }}>Version {PLUGIN_VERSION}</Muted>
|
||||
</Container>
|
||||
{/* More-menu modal (opened by the three-dots button in the header) — stubs for now */}
|
||||
{moreOpen && (
|
||||
<Modal
|
||||
title="Menu"
|
||||
open={true}
|
||||
position="right"
|
||||
onCloseButtonClick={function () { setMoreOpen(false) }}
|
||||
onOverlayClick={function () { setMoreOpen(false) }}
|
||||
>
|
||||
<Stack space="small">
|
||||
<Muted>Stub actions</Muted>
|
||||
<Button onClick={function () { setMoreOpen(false) }}>Stub action 1</Button>
|
||||
<Button onClick={function () { setMoreOpen(false) }}>Stub action 2</Button>
|
||||
{/* More-menu modal — old-plugin style: library Modal + Container + Stack of MenuItem */}
|
||||
<Modal open={moreOpen} onClose={function () { setMoreOpen(false) }} onOverlayClick={function () { setMoreOpen(false) }}>
|
||||
<Container space="extraSmall">
|
||||
<VerticalSpace space="extraSmall" />
|
||||
<Stack space="extraSmall">
|
||||
<MenuItem
|
||||
icon={<IconWand24 />}
|
||||
onClick={function () { setMoreOpen(false) /* stub */ }}
|
||||
>
|
||||
Stub action 1
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
icon={<IconComponent24 />}
|
||||
onClick={function () { setMoreOpen(false) /* stub */ }}
|
||||
>
|
||||
Stub action 2
|
||||
</MenuItem>
|
||||
</Stack>
|
||||
</Modal>
|
||||
)}
|
||||
</Container>
|
||||
<VerticalSpace space="extraSmall" />
|
||||
</Modal>
|
||||
{/* Decorative drag-handle icon in the bottom-right corner (as in the old plugin).
|
||||
pointerEvents:none — the actual drag is caught by the invisible corner div. */}
|
||||
<div
|
||||
|
||||
Reference in new issue
Block a user