fix(workspace): resize project menu
This commit is contained in:
@@ -400,7 +400,7 @@ describe('ProjectSwitcher runtime fields', () => {
|
|||||||
expect(trigger.closest('.project-switcher')).not.toContainElement(menu)
|
expect(trigger.closest('.project-switcher')).not.toContainElement(menu)
|
||||||
expect(menu.closest('.floating-portal')?.parentElement).toBe(document.body)
|
expect(menu.closest('.floating-portal')?.parentElement).toBe(document.body)
|
||||||
const surface = screen.getByRole('dialog', { name: '项目与活动' })
|
const surface = screen.getByRole('dialog', { name: '项目与活动' })
|
||||||
expect(surface.style.width).toBe('920px')
|
expect(surface.style.width).toBe('680px')
|
||||||
const selected = within(menu).getByRole('menuitemradio', { checked: true })
|
const selected = within(menu).getByRole('menuitemradio', { checked: true })
|
||||||
await waitFor(() => expect(screen.getByRole('tab', { name: '全部项目' })).toHaveFocus())
|
await waitFor(() => expect(screen.getByRole('tab', { name: '全部项目' })).toHaveFocus())
|
||||||
fireEvent.pointerDown(selected)
|
fireEvent.pointerDown(selected)
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export function WorkspaceMenu({
|
|||||||
if (!menu || !anchor) return
|
if (!menu || !anchor) return
|
||||||
const position = (): void => {
|
const position = (): void => {
|
||||||
const rect = anchor.getBoundingClientRect()
|
const rect = anchor.getBoundingClientRect()
|
||||||
const width = Math.min(920, window.innerWidth - 32)
|
const width = Math.min(680, window.innerWidth - 32)
|
||||||
menu.style.width = `${width}px`
|
menu.style.width = `${width}px`
|
||||||
menu.style.left = `${Math.max(16, Math.min(rect.left, window.innerWidth - width - 16))}px`
|
menu.style.left = `${Math.max(16, Math.min(rect.left, window.innerWidth - width - 16))}px`
|
||||||
const top = Math.max(16, rect.bottom + 8)
|
const top = Math.max(16, rect.bottom + 8)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
.workspace-menu__layout {
|
.workspace-menu__layout {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
|
grid-template-columns: minmax(260px, 260px) minmax(0, 1fr);
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user