Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component Menu Picker with Radix #6078

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions editor/src/components/editor/canvas-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ export const CanvasToolbar = React.memo(() => {
'storedLayoutToResolvedPanels panel visibility',
)

const panelPopupItems: DropdownMenuItem[] = React.useMemo(
() => [
const panelPopupItems = React.useMemo(
(): DropdownMenuItem[] => [
{
id: 'navigator',
label: 'Navigator',
Expand All @@ -369,6 +369,11 @@ export const CanvasToolbar = React.memo(() => {
),
shortcut: keyToString(shortcutDetailsWithDefaults[TOGGLE_NAVIGATOR].shortcutKeys[0]),
onSelect: () => dispatch([togglePanel('leftmenu')]),
subMenuItems: [
{ id: 'aaa', label: 'aaa', onSelect: NO_OP },
{ id: 'bbb', label: 'bbb', onSelect: NO_OP },
{ id: 'ccc', label: 'ccc', onSelect: NO_OP },
],
},
{
id: 'rightmenu',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import type { DropdownMenuItem } from '../../uuiui/radix-components'
import { DropdownMenu } from '../../uuiui/radix-components'

export const AddRemoveLayoutSystemControlTestId = (): string => 'AddRemoveLayoutSystemControlTestId'
export const AddFlexLayoutOptionId = 'add-flex-layout'
export const AddGridLayoutOptionId = 'add-grid-layout'
export const AddFlexLayoutOptionId = 'add-flex-layout-option'
export const AddGridLayoutOptionId = 'add-grid-layout-option'

interface AddRemoveLayoutSystemControlProps {}

Expand Down
5 changes: 2 additions & 3 deletions editor/src/components/inspector/layout-systems.test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { ItemContainerTestId } from '../../uuiui/radix-components'
import { mouseClickAtPoint } from '../canvas/event-helpers.test-utils'
import type { EditorRenderResult } from '../canvas/ui-jsx.test-utils'
import {
Expand All @@ -18,13 +17,13 @@ async function openLayoutDropdown(editor: EditorRenderResult) {

export async function addFlexLayout(editor: EditorRenderResult) {
await openLayoutDropdown(editor)
const flexOption = editor.renderedDOM.getByTestId(ItemContainerTestId(AddFlexLayoutOptionId))
const flexOption = editor.renderedDOM.getByTestId(AddFlexLayoutOptionId)
await userEvent.click(flexOption)
}

export async function addGridLayout(editor: EditorRenderResult) {
await openLayoutDropdown(editor)
const gridOption = editor.renderedDOM.getByTestId(ItemContainerTestId(AddGridLayoutOptionId))
const gridOption = editor.renderedDOM.getByTestId(AddGridLayoutOptionId)
await userEvent.click(gridOption)
}

Expand Down
Loading
Loading