diff --git a/__test__/layout/account-menu.spec.ts b/__test__/layout/account-menu.spec.ts new file mode 100644 index 00000000..6e576b98 --- /dev/null +++ b/__test__/layout/account-menu.spec.ts @@ -0,0 +1,45 @@ +import { avatarDropdownClick } from '../../apps/admin/src/layout/components/SiderBar/shared' + +const { logout, createDialog, showError, push } = vi.hoisted(() => ({ + logout: vi.fn(), + createDialog: vi.fn(), + showError: vi.fn(), + push: vi.fn(), +})) + +vi.mock('@/store', () => ({ + useSigningActions: () => ({ logout }), + useSettingActions: () => ({ updateSettingState: vi.fn() }), +})) +vi.mock('@/hooks', () => ({ useI18n: () => ({ t: (key: string) => key }) })) +vi.mock('@/router', () => ({ router: { push } })) + +beforeEach(() => { + vi.clearAllMocks() + window.$dialog = { create: createDialog } as unknown as typeof window.$dialog + window.$message = { error: showError } as unknown as typeof window.$message +}) + +it('confirms sign-out with the active primary color before ending the session', async () => { + logout.mockResolvedValue(void 0) + await avatarDropdownClick('logout') + + expect(logout).not.toHaveBeenCalled() + const dialog = createDialog.mock.calls[0]![0] + + expect(dialog).toMatchObject({ + title: 'signOut', + showIcon: false, + positiveButtonProps: { type: 'primary' }, + }) + expect(await dialog.onPositiveClick()).toBe(true) + expect(logout).toHaveBeenCalledOnce() +}) + +it('keeps the confirmation open and reports a failed sign-out', async () => { + logout.mockRejectedValue(new Error('offline')) + await avatarDropdownClick('logout') + + expect(await createDialog.mock.calls[0]![0].onPositiveClick()).toBe(false) + expect(showError).toHaveBeenCalledWith('signOutFailed') +}) diff --git a/__test__/layout/mobile-search.spec.ts b/__test__/layout/mobile-search.spec.ts index 75eb8f10..7535b6db 100644 --- a/__test__/layout/mobile-search.spec.ts +++ b/__test__/layout/mobile-search.spec.ts @@ -1,22 +1,63 @@ -import { mount } from '@vue/test-utils' +import { flushPromises, mount } from '@vue/test-utils' import GlobalSearch from '../../apps/admin/src/layout/components/Search/GlobalSearch' import { router } from '../../apps/admin/src/router' +import { piniaMenuStore } from '../../apps/admin/src/store/modules/menu' import setupMiniApp from '../utils/setupMiniApp' -it('mounts the header search on a narrow viewport and closes it immediately', async () => { +it('keeps page search available on phones and lets a search result close the dialog', async () => { vi.stubGlobal('innerWidth', 390) const { app } = await setupMiniApp() + const menu = piniaMenuStore() + + menu.options = [ + { + path: '/visible', + fullPath: '/visible', + key: '/visible', + name: 'visible', + breadcrumbLabel: 'Visible page', + label: 'Visible page', + meta: {}, + }, + ] + const navigate = vi + .spyOn(menu, 'changeMenuModelValue') + .mockImplementation(() => void 0) + const wrapper = mount(GlobalSearch, { + attachTo: document.body, + props: { show: true }, + global: { + plugins: [router], + stubs: { + teleport: true, + RIcon: { inheritAttrs: false, template: '' }, + }, + }, + }) try { - const wrapper = mount(GlobalSearch, { - props: { show: true }, - global: { plugins: [router] }, - }) + await flushPromises() + expect(wrapper.emitted('update:show')).toBeUndefined() + expect(wrapper.find('.global-search').exists()).toBe(true) + await wrapper.get('input').setValue('Visible') + await flushPromises() + expect(wrapper.findAll('.global-search__destination')).toHaveLength(1) + vi.stubGlobal('innerWidth', 1440) + window.dispatchEvent(new Event('resize')) + await flushPromises() + expect(wrapper.emitted('update:show')).toBeUndefined() + expect(wrapper.get('input').element.value).toBe('Visible') + + await wrapper.get('.global-search__destination').trigger('click') + await flushPromises() + expect(navigate).toHaveBeenCalledWith( + '/visible', + expect.objectContaining({ fullPath: '/visible' }), + ) expect(wrapper.emitted('update:show')).toContainEqual([false]) - expect(wrapper.find('.global-search').exists()).toBe(false) - wrapper.unmount() } finally { + wrapper.unmount() app.unmount() vi.unstubAllGlobals() } diff --git a/__test__/layout/sidebar-scroll.spec.ts b/__test__/layout/sidebar-scroll.spec.ts index 3f626af6..b0d32be8 100644 --- a/__test__/layout/sidebar-scroll.spec.ts +++ b/__test__/layout/sidebar-scroll.spec.ts @@ -1,12 +1,14 @@ -import { mount } from '@vue/test-utils' +import { flushPromises, mount } from '@vue/test-utils' import { createPinia, disposePinia, setActivePinia } from 'pinia' import { nextTick } from 'vue' import { useSiderScroll } from '../../apps/admin/src/hooks/template/useSiderScroll' import Menu from '../../apps/admin/src/layout/components/Menu' import { router } from '../../apps/admin/src/router' import { piniaMenuStore } from '../../apps/admin/src/store/modules/menu' +import { piniaRuntimeStore } from '../../apps/admin/src/store/modules/runtime' import { piniaSettingStore } from '../../apps/admin/src/store/modules/setting' import { positionSelectedMenuItem } from '../../apps/admin/src/utils' +import setupMiniApp from '../utils/setupMiniApp' it.each([ [true, '.n-layout-scroll-container'], @@ -78,3 +80,46 @@ it.each([ } }, ) + +it('keeps the desktop collapse preference while the phone menu opens and closes', async () => { + vi.stubGlobal('innerWidth', 390) + const { app } = await setupMiniApp() + const menu = piniaMenuStore() + const runtime = piniaRuntimeStore() + + menu.updateMenuState('collapsed', true) + runtime.setRuntimeState('globalDrawerValue', true) + const wrapper = mount(Menu, { + attachTo: document.body, + global: { + plugins: [router], + stubs: { + teleport: true, + RIcon: { inheritAttrs: false, template: '' }, + }, + }, + }) + + try { + await flushPromises() + expect(menu.collapsed).toBe(true) + expect(wrapper.find('.app-menu__mobile-heading').exists()).toBe(true) + expect(wrapper.find('.n-layout-sider--collapsed').exists()).toBe(false) + + await wrapper.get('.app-menu__close').trigger('click') + expect(runtime.globalDrawerValue).toBe(false) + runtime.setRuntimeState('globalDrawerValue', true) + + vi.stubGlobal('innerWidth', 1440) + window.dispatchEvent(new Event('resize')) + await flushPromises() + expect(runtime.globalDrawerValue).toBe(false) + expect(menu.collapsed).toBe(true) + expect(wrapper.find('.app-menu__mobile-heading').exists()).toBe(false) + expect(wrapper.find('.n-layout-sider--collapsed').exists()).toBe(true) + } finally { + wrapper.unmount() + app.unmount() + vi.unstubAllGlobals() + } +}) diff --git a/__test__/layout/workspace-settings.spec.tsx b/__test__/layout/workspace-settings.spec.tsx index e6f964ab..b5ec0c36 100644 --- a/__test__/layout/workspace-settings.spec.tsx +++ b/__test__/layout/workspace-settings.spec.tsx @@ -16,6 +16,71 @@ describe('workspace preference shortcuts', () => { afterEach(() => disposePinia(pinia)) + it('identifies the default spacing when settings first opens', () => { + const wrapper = mount(Layout, { global: { plugins: [pinia] } }) + + try { + const selected = wrapper.findAll( + '.r-workspace-presets button[aria-pressed="true"]', + ) + + expect(selected).toHaveLength(1) + expect(selected[0].text()).toContain('preferences.layout.spacious') + expect(wrapper.get('.r-workspace-presets__current').text()).toContain( + '24 px', + ) + } finally { + wrapper.unmount() + } + }) + + it.each([ + { contentWidth: 'fluid' as const, contentPadding: 16 }, + { + contentWidth: 'fixed' as const, + contentMaxWidth: 1200, + contentPadding: 24, + }, + ])('shows saved custom spacing without changing it: %j', async (layout) => { + const store = piniaSettingStore() + + store.updateSettingState('layoutConfig', layout) + const previousLayout = { ...store.layoutConfig } + const wrapper = mount(Layout, { global: { plugins: [pinia] } }) + + try { + const current = wrapper.get('.r-workspace-presets__current') + + expect(current.text()).toContain('preferences.layout.custom') + expect(current.text()).toContain(`${layout.contentPadding} px`) + expect( + wrapper.findAll('.r-workspace-presets button[aria-pressed="true"]'), + ).toHaveLength(0) + expect(store.layoutConfig).toEqual(previousLayout) + + await wrapper + .findAll('.r-workspace-presets button') + .find((button) => button.text() === 'preferences.layout.compact')! + .trigger('click') + + expect(current.text()).toContain('preferences.layout.compact') + expect(current.text()).toContain('8 px') + expect( + wrapper.get('.r-workspace-presets button[aria-pressed="true"]').text(), + ).toContain('preferences.layout.compact') + + await wrapper + .findAll('button') + .find((button) => button.text() === 'layout.reset')! + .trigger('click') + + expect(current.text()).toContain('preferences.layout.spacious') + expect(current.text()).toContain('24 px') + } finally { + wrapper.unmount() + } + }) + it('applies reading spacing without replacing navigation or fixed bars', async () => { const store = piniaSettingStore() diff --git a/apps/admin/src/app-components/app/AppAvatar/index.tsx b/apps/admin/src/app-components/app/AppAvatar/index.tsx index 39eba97a..18db672a 100644 --- a/apps/admin/src/app-components/app/AppAvatar/index.tsx +++ b/apps/admin/src/app-components/app/AppAvatar/index.tsx @@ -84,12 +84,13 @@ const AppAvatar = defineComponent({ return ( - + )} + {this.$slots.suffix?.()} ) diff --git a/apps/admin/src/app-components/app/AppShareLink/index.scss b/apps/admin/src/app-components/app/AppShareLink/index.scss index c24ae947..6919782b 100644 --- a/apps/admin/src/app-components/app/AppShareLink/index.scss +++ b/apps/admin/src/app-components/app/AppShareLink/index.scss @@ -10,25 +10,36 @@ display: flex; align-items: center; gap: 12px; - min-width: 0; - padding: 13px 16px; + min-inline-size: 0; + min-block-size: 44px; + padding: 12px 16px; border: 1px solid var(--r-line); border-radius: var(--r-control-radius); color: var(--r-text-secondary); text-decoration: none; font-size: 13px; - background: var(--r-surface-muted); + background: var(--r-surface); - > span:nth-child(2) { + &__label { flex: 1; overflow-wrap: anywhere; } - > .n-avatar { + &__icon { + display: grid; + place-items: center; + inline-size: 32px; + block-size: 32px; flex-shrink: 0; + color: var(--r-primary-text); + } + &__arrow { + flex-shrink: 0; + color: var(--r-text-muted); } &:hover { color: var(--r-text); border-color: var(--r-control-border); + background: var(--r-surface-muted); } } @container (min-width: 700px) { @@ -48,14 +59,14 @@ .r-share-link { display: grid; place-items: center; - width: 36px; - height: 36px; + inline-size: 44px; + block-size: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; - > span:nth-child(2), - > .r-icon { + > .r-share-link__label, + > .r-share-link__arrow { display: none; } &:hover { diff --git a/apps/admin/src/app-components/app/AppShareLink/index.tsx b/apps/admin/src/app-components/app/AppShareLink/index.tsx index 7056e633..a2bc9d20 100644 --- a/apps/admin/src/app-components/app/AppShareLink/index.tsx +++ b/apps/admin/src/app-components/app/AppShareLink/index.tsx @@ -2,14 +2,14 @@ import './index.scss' import { RAY_TEMPLATE_DOCS_URL } from '@/app-config' import { RIcon } from '@/components' import { useI18n } from '@/hooks' -import { NAvatar } from 'naive-ui' +import type { IconName } from '@/icons' import type { PropType } from 'vue' -interface AvatarOptions { +interface ShareLinkOption { key: string src: string tooltip: string - icon: string + icon: IconName } export default defineComponent({ @@ -22,40 +22,40 @@ export default defineComponent({ }, setup() { const { t } = useI18n('dashboard') - const avatarOptions: AvatarOptions[] = [ + const links: ShareLinkOption[] = [ { key: 'ray-js-note', src: 'https://note.youdao.com/s/ObWEe2BB', tooltip: 'links.notes', - icon: 'https://avatars.githubusercontent.com/u/51957438?v=4', + icon: 'navigation/form', }, { key: 'ray-js-cover', src: 'https://note.youdao.com/s/IC8xKPdB', tooltip: 'links.interviews', - icon: 'https://avatars.githubusercontent.com/u/51957438?v=4', + icon: 'status/question', }, { key: 'ray-template-doc', src: RAY_TEMPLATE_DOCS_URL, tooltip: 'links.docs', - icon: 'https://avatars.githubusercontent.com/u/51957438?v=4', + icon: 'navigation/document', }, { key: 'ray-template-doc-out', src: 'https://ray-template.yunkuangao.com/', tooltip: 'links.docsMirror', - icon: 'https://avatars.githubusercontent.com/u/51957438?v=4', + icon: 'navigation/window', }, ] - return { avatarOptions, t } + return { links, t } }, render() { return (
diff --git a/apps/admin/src/layout/README.md b/apps/admin/src/layout/README.md index 6e750ce7..74de5a7f 100644 --- a/apps/admin/src/layout/README.md +++ b/apps/admin/src/layout/README.md @@ -12,7 +12,7 @@ - At ≤768px, use the complete-menu drawer without overwriting saved desktop mode. Selecting a drawer item closes it automatically. - Sidebar/drawer logos remain fixed above the menu; scrolling begins at the menu region. The native-scrollbar option affects only the menu list. - Content supports fluid fill or centered fixed width, maximum widths of 640–2560px, spacing of 0–48px, and fixed or scrolling headers/footers. Tab and copyright visibility retain existing settings. -- Maximized content shares Pinia state with pages and tab menus. An exit button floats at the top right; Esc restores the layout too. +- Maximized content shares Pinia state with pages and tab menus. The exit button floats at the top right. On narrow screens the shell reserves no space for it. Click it or press Esc to restore the layout. - Content loading uses the visible scrolling viewport. Remounting shows the indicator immediately; brief manual loading waits 120ms. Fixed headers, tabs, and footers are not covered by the overlay. - “外观 → 页面切换动画” (Appearance → Page transition) retains previous options and adds upward fade-in and leftward slide-in. Only content animates; reduced-motion system settings use immediate transitions. diff --git a/apps/admin/src/layout/components/Menu/index.scss b/apps/admin/src/layout/components/Menu/index.scss index 5fa313b0..09841f1c 100644 --- a/apps/admin/src/layout/components/Menu/index.scss +++ b/apps/admin/src/layout/components/Menu/index.scss @@ -65,3 +65,25 @@ outline-offset: -2px; } } + +.app-menu__mobile-heading { + display: flex; + align-items: center; + flex-shrink: 0; + min-inline-size: 0; + padding-inline-end: 8px; + border-block-end: 1px solid var(--r-line); + + .r-menu__logo { + flex: 1; + min-inline-size: 0; + padding-inline: 16px 8px; + border-block-end: 0; + } + + .app-menu__close { + min-inline-size: 44px; + min-block-size: 44px; + margin-inline-start: auto; + } +} diff --git a/apps/admin/src/layout/components/Menu/index.tsx b/apps/admin/src/layout/components/Menu/index.tsx index ec4e3e2b..61024cec 100644 --- a/apps/admin/src/layout/components/Menu/index.tsx +++ b/apps/admin/src/layout/components/Menu/index.tsx @@ -1,6 +1,7 @@ import './index.scss' import { LAYOUT_SIDER_REF } from '@/app-config' -import { useDevice } from '@/hooks' +import { RIcon } from '@/components' +import { useDevice, useI18n } from '@/hooks' import { positionSelectedMenuItem } from '@/layout/utils/position-selected-menu-item' import { useMenuActions, @@ -10,7 +11,7 @@ import { useSettingGetters, } from '@/store' import type { AppMenuOption, NaiveMenuOptions } from '@/types' -import { NDrawer, NLayoutContent, NLayoutSider, NMenu } from 'naive-ui' +import { NButton, NDrawer, NLayoutContent, NLayoutSider, NMenu } from 'naive-ui' import type { MenuInst } from 'naive-ui' import type { PropType } from 'vue' import SiderBarLogo from './components/SiderBarLogo' @@ -25,16 +26,15 @@ export default defineComponent({ }, setup(props) { const menuRef = shallowRef(null) - const { changeMenuModelValue, collapsedMenu, updateMenuState } = - useMenuActions() + const { changeMenuModelValue, collapsedMenu } = useMenuActions() + const { t } = useI18n('layout') const { getAppTheme, getMenuConfig } = useSettingGetters() const { getMenuOptions, getCollapsed, getMenuKey } = useMenuGetters() const { globalDrawerValue } = useRuntimeGetters() const { setRuntimeState } = useRuntimeActions() const { isTabletOrSmaller, width } = useDevice({ observer: (isSmaller) => { - if (isSmaller) updateMenuState('collapsed', false) - else setRuntimeState('globalDrawerValue', false) + if (!isSmaller) setRuntimeState('globalDrawerValue', false) }, }) const menuWidth = computed(() => @@ -59,6 +59,11 @@ export default defineComponent({ { flush: 'post' }, ) + const logo = () => + props.showLogo && getMenuConfig.value.menuSiderBarLogo ? ( + + ) : null + const basicMenu = () => ( - {props.showLogo && getMenuConfig.value.menuSiderBarLogo ? ( - - ) : null} + {isTabletOrSmaller.value ? ( +
+ {logo()} + setRuntimeState('globalDrawerValue', false)} + > + + +
+ ) : ( + logo() + )} @@ -129,7 +156,6 @@ export default defineComponent({ onUpdateShow={(value) => setRuntimeState('globalDrawerValue', value)} placement="left" displayDirective="show" - autoFocus={false} > {basicMenu()} diff --git a/apps/admin/src/layout/components/Search/GlobalSearch/index.scss b/apps/admin/src/layout/components/Search/GlobalSearch/index.scss index 12c9459e..baf0c2da 100644 --- a/apps/admin/src/layout/components/Search/GlobalSearch/index.scss +++ b/apps/admin/src/layout/components/Search/GlobalSearch/index.scss @@ -1,7 +1,13 @@ .global-search.n-card { - width: min(650px, calc(100vw - 40px)); - margin: 60px auto auto; - border-radius: 12px; + inline-size: min(650px, calc(100dvw - 24px)); + max-block-size: calc(100dvh - 24px); + margin: 12px auto auto; + border-radius: var(--r-radius); + + .n-card__content { + min-block-size: 0; + overflow: auto; + } .n-card__action { padding: 12px 20px; @@ -39,7 +45,7 @@ .global-search__item { gap: 4px; border: 1px solid var(--r-line); - border-radius: 8px; + border-radius: var(--r-control-radius); margin-block: 6px; padding-inline-end: 8px; @@ -57,7 +63,7 @@ min-height: 46px; padding: 10px 12px; border: 0; - border-radius: 8px; + border-radius: var(--r-control-radius); background: transparent; color: var(--r-text); text-align: start; @@ -97,3 +103,43 @@ border-radius: 4px; } } + +.global-search__results { + max-block-size: min(440px, calc(100dvh - 230px)); +} + +@media (max-width: 768px) { + .global-search.n-card { + .n-card-header { + padding: 12px 16px; + } + + .n-card__content { + padding-inline: 16px; + } + + .n-card__action { + padding: 12px 16px; + } + } + + .global-search__header > .n-button, + .global-search__favorite { + min-inline-size: 44px; + min-block-size: 44px; + } + + .global-search__shortcut { + display: none; + } + + .global-search__help:has(> :not(.global-search__shortcut)) { + justify-content: flex-end; + } +} + +@media (min-width: 769px) { + .global-search.n-card { + margin-block-start: min(60px, 8dvh); + } +} diff --git a/apps/admin/src/layout/components/Search/GlobalSearch/index.tsx b/apps/admin/src/layout/components/Search/GlobalSearch/index.tsx index bb8dcf84..8d03c47e 100644 --- a/apps/admin/src/layout/components/Search/GlobalSearch/index.tsx +++ b/apps/admin/src/layout/components/Search/GlobalSearch/index.tsx @@ -1,6 +1,6 @@ import './index.scss' import { RIcon } from '@/components' -import { useDevice, useI18n } from '@/hooks' +import { useI18n } from '@/hooks' import { positionSelectedMenuItem } from '@/layout/utils/position-selected-menu-item' import { useMenuActions, @@ -42,11 +42,6 @@ export default defineComponent({ if (!value) resetSearch() }, }) - const { isTabletOrSmaller } = useDevice({ - observer: (small) => { - if (small) modelShow.value = false - }, - }) const visibleLeaves = computed(() => { const leaves: AppMenuOption[] = [] const visit = (items: AppMenuOption[]) => { @@ -157,8 +152,7 @@ export default defineComponent({ } useEventListener(window, 'keydown', (event: KeyboardEvent) => { - if (event.isComposing || isTabletOrSmaller.value || modelShow.value) - return + if (event.isComposing || modelShow.value) return if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'k') { event.preventDefault() @@ -167,168 +161,162 @@ export default defineComponent({ } }) - return () => - isTabletOrSmaller.value ? null : ( - { - modelShow.value = value - }} - onAfterEnter={() => input.value?.focus()} - transformOrigin="center" - displayDirective="if" + return () => ( + { + modelShow.value = value + }} + onAfterEnter={() => input.value?.focus()} + transformOrigin="center" + displayDirective="if" + > + - - {{ - header: () => ( -
- - { - modelShow.value = false - }} - > - - -
- ), - default: () => ( - <> - { - searchValue.value = value - }} - placeholder={t('placeholder')} - inputProps={{ - id: inputId, - name: 'page-search', - autocapitalize: 'off', - spellcheck: false, - }} - onKeydown={(event) => moveResult(event, true)} - clearable - > - {{ prefix: () => }} - - {storageUnavailable.value && ( -

- {t('storageUnavailable')} + {{ + header: () => ( +

+ + { + modelShow.value = false + }} + > + + +
+ ), + default: () => ( + <> + { + searchValue.value = value + }} + placeholder={t('placeholder')} + inputProps={{ + id: inputId, + name: 'page-search', + autocapitalize: 'off', + spellcheck: false, + }} + onKeydown={(event) => moveResult(event, true)} + clearable + > + {{ prefix: () => }} + + {storageUnavailable.value && ( +

+ {t('storageUnavailable')} +

+ )} + + {options.value.length ? ( + groups.value.map((group) => ( +
+
+

{t(group.key)}

+
+
    + {group.options.map((option) => { + const favorite = favoritePaths.value.includes( + option.fullPath, + ) + + return ( +
  • + + toggle(option.fullPath)} + > + + +
  • + ) + })} +
+
+ )) + ) : ( +

+ {t(searchValue.value.trim() ? 'noResults' : 'empty')}

)} - - {options.value.length ? ( - groups.value.map((group) => ( -
-
-

{t(group.key)}

-
-
    - {group.options.map((option) => { - const favorite = favoritePaths.value.includes( - option.fullPath, - ) - - return ( -
  • - - toggle(option.fullPath)} - > - - -
  • - ) - })} -
-
- )) - ) : ( -

- {t(searchValue.value.trim() ? 'noResults' : 'empty')} -

- )} -
- - ), - action: () => ( -
- - ↑ ↓ {t('move')} - - - ↵ {t('open')} - - - Esc {t('close')} - - {recentPaths.value.length > 0 && ( - - {t('clearRecent')} - - )} -
- ), - }} -
-
- ) + + + ), + action: () => ( +
+ + ↑ ↓ {t('move')} + + + ↵ {t('open')} + + + Esc {t('close')} + + {recentPaths.value.length > 0 && ( + + {t('clearRecent')} + + )} +
+ ), + }} + +
+ ) }, }) diff --git a/apps/admin/src/layout/components/SiderBar/components/Breadcrumb/index.scss b/apps/admin/src/layout/components/SiderBar/components/Breadcrumb/index.scss index d662836c..3cedfb6d 100644 --- a/apps/admin/src/layout/components/SiderBar/components/Breadcrumb/index.scss +++ b/apps/admin/src/layout/components/SiderBar/components/Breadcrumb/index.scss @@ -1,4 +1,4 @@ -.n-breadcrumb .n-breadcrumb-item { +.layout-breadcrumb .n-breadcrumb-item { &.breadcrumb-enter-active, &.breadcrumb-leave-active { transition: all 0.3s var(--r-bezier); @@ -18,3 +18,17 @@ position: absolute; } } + +.layout-breadcrumb, +.layout-breadcrumb__current { + min-inline-size: 0; +} + +.layout-breadcrumb__current { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 15px; + font-weight: 600; + color: var(--r-text); +} diff --git a/apps/admin/src/layout/components/SiderBar/components/Breadcrumb/index.tsx b/apps/admin/src/layout/components/SiderBar/components/Breadcrumb/index.tsx index f39dff79..58bb33d5 100644 --- a/apps/admin/src/layout/components/SiderBar/components/Breadcrumb/index.tsx +++ b/apps/admin/src/layout/components/SiderBar/components/Breadcrumb/index.tsx @@ -45,9 +45,11 @@ export default defineComponent({ const { dropdownSelect, breadcrumbItemClick } = this return isTabletOrSmaller ? ( -
+ + {getBreadcrumbOptions.at(-1)?.breadcrumbLabel} + ) : ( - + {getBreadcrumbOptions.map((curr) => ( .n-tabs-nav > .n-tabs-rail { - box-sizing: border-box; - gap: 6px; - padding: 8px 14px; + &__tab { + min-block-size: 44px; + } + + > .n-tabs-nav { border: 1px solid var(--r-line); border-radius: var(--r-radius); background: var(--r-surface); - - > .n-tabs-tab-wrapper { - min-inline-size: 0; - - > .n-tabs-tab { - min-block-size: 40px; - box-sizing: border-box; - padding: 8px 6px; - } - - > .n-tabs-tab--active { - color: var(--r-primary-text); - } - } - - > .n-tabs-capsule { - border-radius: var(--r-control-radius); - background: var(--r-surface-muted); - box-shadow: none; - } } > .n-tab-pane { @@ -254,6 +231,20 @@ inline-size: 14px; margin-inline-start: 6px; } + + &__current { + display: flex; + flex-wrap: wrap; + gap: 4px 8px; + margin: 0; + color: var(--r-text-secondary); + font-size: 12px; + + strong { + color: var(--r-primary-text); + font-weight: 600; + } + } } .r-settings-switch { diff --git a/apps/admin/src/layout/components/SiderBar/components/SettingDrawer/index.tsx b/apps/admin/src/layout/components/SiderBar/components/SettingDrawer/index.tsx index d36b272e..bf4b8132 100644 --- a/apps/admin/src/layout/components/SiderBar/components/SettingDrawer/index.tsx +++ b/apps/admin/src/layout/components/SiderBar/components/SettingDrawer/index.tsx @@ -144,9 +144,18 @@ export default defineComponent({ ), default: () => ( {categories.map(({ key, icon, view: View }) => (

{t('layout.presetsHint')}

-
+
{Object.entries(workspacePresets).map(([key, config]) => ( ))}
+

+ {t('layout.current')} + {t(`layout.${activePreset.value ?? 'custom'}`)} + {getLayoutConfig.value.contentPadding} px +

diff --git a/apps/admin/src/layout/components/SiderBar/index.scss b/apps/admin/src/layout/components/SiderBar/index.scss index e6184593..7be65a28 100644 --- a/apps/admin/src/layout/components/SiderBar/index.scss +++ b/apps/admin/src/layout/components/SiderBar/index.scss @@ -1,20 +1,121 @@ .layout-header { - height: $layoutHeaderHeight; - padding: 0 $layoutRouterViewContainer; + block-size: $layoutHeaderHeight; + padding-inline: $layoutRouterViewContainer; display: flex; align-items: center; - border-bottom: 1px solid var(--r-line); + border-block-end: 1px solid var(--r-line); > .layout-header__method { - width: 100%; + inline-size: 100%; + min-inline-size: 0; + gap: 16px; + } + + &__navigation { + min-inline-size: 0; + flex: 1; + overflow: hidden; + } + + &__actions { + flex-shrink: 0; } .n-breadcrumb { font-size: 13px; } + + .override-button__layout, + &__menu-toggle { + inline-size: 36px; + padding: 0; + border-radius: var(--r-control-radius); + color: var(--r-text-secondary); + } + + &__account { + block-size: 40px; + margin-inline-start: 8px; + padding-inline: 8px; + border-radius: var(--r-control-radius); + + &.is-open { + background: var(--r-surface-hover); + } + + .r-app-avatar__name { + max-inline-size: 9rem; + font-weight: 500; + } + } + + &__account-chevron { + color: var(--r-text-muted); + transition: transform 160ms ease; + } + + &__account.is-open &__account-chevron { + transform: rotate(180deg); + } } -.override-button__layout { - padding: 0 9px; - border-radius: 8px; +.layout-account-menu { + min-inline-size: 224px; + max-inline-size: calc(100dvw - 24px); + + &__identity { + display: grid; + gap: 4px; + max-inline-size: 256px; + padding: 12px 16px 8px; + overflow-wrap: anywhere; + + > span { + color: var(--r-text-muted); + font-size: 12px; + } + + > strong { + color: var(--r-text); + font-size: 14px; + font-weight: 600; + } + } +} + +@media (max-width: 768px) { + .layout-header { + padding-inline: 8px; + + > .layout-header__method { + gap: 4px; + } + + .override-button__layout, + &__menu-toggle, + &__account { + inline-size: 44px; + block-size: 44px; + padding: 0; + } + + &__account { + margin-inline-start: 0; + + .r-app-avatar__name, + .layout-header__account-chevron { + display: none; + } + } + } + + .layout-account-menu .n-dropdown-option-body { + min-block-size: 44px; + } +} + +@media (prefers-reduced-motion: reduce) { + .layout-header__account-chevron { + transition: none; + } } diff --git a/apps/admin/src/layout/components/SiderBar/index.tsx b/apps/admin/src/layout/components/SiderBar/index.tsx index ec7ef7dc..85f76ad3 100644 --- a/apps/admin/src/layout/components/SiderBar/index.tsx +++ b/apps/admin/src/layout/components/SiderBar/index.tsx @@ -4,9 +4,12 @@ import AppAvatar from '@/app-components/app/AppAvatar' import { LOCAL_OPTIONS } from '@/app-config' import { RIcon } from '@/components' import { useDevice, useI18n } from '@/hooks' -import { useSettingActions, useSettingGetters } from '@/store' -import { NButton, NDropdown, NFlex, NLayoutHeader, NScrollbar } from 'naive-ui' -import type { VNode } from 'vue' +import { + useSettingActions, + useSettingGetters, + useSigningGetters, +} from '@/store' +import { NButton, NDropdown, NFlex, NLayoutHeader } from 'naive-ui' import { useFullscreen } from 'vue-hooks-plus' import { Breadcrumb, @@ -37,6 +40,8 @@ export default defineComponent({ const { getDrawerPlacement, getBreadcrumbSwitch } = useSettingGetters() // 是否显示设置抽屉 const showSettings = ref(false) + const accountMenuShown = ref(false) + const { getSigningCallback } = useSigningGetters() // 是否展示全局搜索 const globalSearchShown = ref(false) // 当前是否为平板或者更小的设备 @@ -74,7 +79,7 @@ export default defineComponent({ showSettings.value = true }, github: () => { - window.open('https://github.com/XiaoDaiGua-Ray/r-template') + window.open('https://github.com/XiaoDaiGua-Ray/ray-template') }, fullscreen: () => { if (!isEnabled) { @@ -98,15 +103,6 @@ export default defineComponent({ iconEventMap[key]?.() } - /** - * - * @param vnode 需要渲染的节点 - * @returns 如果是平板或者更小的设备, 就返回 null, 否则返回 vnode - */ - const isRenderVNode = (vnode: VNode) => { - return isTabletOrSmaller.value ? null : vnode - } - return { t, isFullscreen, @@ -118,7 +114,9 @@ export default defineComponent({ getDrawerPlacement, getBreadcrumbSwitch, globalSearchShown, - isRenderVNode, + isTabletOrSmaller, + accountMenuShown, + getSigningCallback, } }, render() { @@ -128,7 +126,7 @@ export default defineComponent({ getDrawerPlacement, getBreadcrumbSwitch, } = this - const { toolIconClick, updateLocale, isRenderVNode } = this + const { toolIconClick, updateLocale } = this return ( @@ -139,10 +137,16 @@ export default defineComponent({ justify="space-between" wrap={false} > - + {leftIconOptions.map((curr) => ( ('layout.toggleMenu')} onClick={toolIconClick.bind(this, curr.eventKey ?? curr.name)} @@ -158,15 +162,32 @@ export default defineComponent({ ))} {getBreadcrumbSwitch ? : null} - - {isRenderVNode( + + {this.isTabletOrSmaller ? ( + ('headerTooltip.Search')} + onClick={() => { + this.globalSearchShown = true + }} + > + + + ) : ( { e.stopPropagation() this.globalSearchShown = true }} - />, + /> )} {rightTooltipIconOptions.map((curr) => ( - + ))} ('layout.language')} class="override-button__layout" > - + diff --git a/apps/admin/src/layout/components/SiderBar/shared.ts b/apps/admin/src/layout/components/SiderBar/shared.ts index a7f1b7b1..e8a2d1f4 100644 --- a/apps/admin/src/layout/components/SiderBar/shared.ts +++ b/apps/admin/src/layout/components/SiderBar/shared.ts @@ -1,4 +1,5 @@ import { apiMockEnabled } from '@/api/admin/client' +import { RIcon } from '@/components' import { useI18n } from '@/hooks' import { router } from '@/router' import { ACCOUNT_PROFILE_PATH } from '@/router/constant' @@ -9,10 +10,12 @@ export const createAvatarOptions = (t: ReturnType['t']) => [ { key: 'person', label: t('account.profile'), + icon: () => h(RIcon, { name: 'navigation/form', size: 18 }), }, { key: 'lockScreen', label: t(apiMockEnabled ? 'account.lockScreen' : 'account.lockSession'), + icon: () => h(RIcon, { name: 'action/lock', size: 18 }), }, { type: 'divider', @@ -21,6 +24,7 @@ export const createAvatarOptions = (t: ReturnType['t']) => [ { key: 'logout', label: t('account.signOut'), + icon: () => h(RIcon, { name: 'action/out', size: 18 }), }, ] @@ -46,11 +50,13 @@ export const avatarDropdownClick = async (key: string | number) => { } if (key === 'logout') { - window.$dialog.warning({ + window.$dialog.create({ title: t('signOut'), + showIcon: false, content: t('signOutPrompt'), positiveText: t('signOut'), negativeText: t('cancel'), + positiveButtonProps: { type: 'primary' }, onPositiveClick: () => signOut(), }) } diff --git a/apps/admin/src/locales/lang/en-US/account.json b/apps/admin/src/locales/lang/en-US/account.json index 2d809f2c..32dec4a5 100644 --- a/apps/admin/src/locales/lang/en-US/account.json +++ b/apps/admin/src/locales/lang/en-US/account.json @@ -1,4 +1,5 @@ { + "menu": "Account menu: {name}", "eyebrow": "Account settings", "profile": "My profile", "description": "Manage your profile and sign-in security.", diff --git a/apps/admin/src/locales/lang/en-US/layout.json b/apps/admin/src/locales/lang/en-US/layout.json index e2d9b7de..1cffa06c 100644 --- a/apps/admin/src/locales/lang/en-US/layout.json +++ b/apps/admin/src/locales/lang/en-US/layout.json @@ -30,6 +30,7 @@ "restoreButton": "Exit fullscreen", "loading": "Loading", "tab": "Layout", + "closeMenu": "Close navigation menu", "toggleMenu": "Open navigation menu", "language": "Change language" } diff --git a/apps/admin/src/locales/lang/en-US/preferences.json b/apps/admin/src/locales/lang/en-US/preferences.json index 9f297f7c..a5ef0348 100644 --- a/apps/admin/src/locales/lang/en-US/preferences.json +++ b/apps/admin/src/locales/lang/en-US/preferences.json @@ -154,6 +154,8 @@ "spacious": "Comfortable spacing", "compact": "Compact spacing", "reading": "Centered reading", + "current": "Current", + "custom": "Custom spacing", "focus": "Focus workspace", "maximize": "Maximize content", "maximizeHint": "Temporarily hide navigation and the footer. Close settings to see the result, then press Esc or use the exit button to restore. This resets on page reload." diff --git a/apps/admin/src/locales/lang/zh-CN/account.json b/apps/admin/src/locales/lang/zh-CN/account.json index bfeaf114..7ad8ab1a 100644 --- a/apps/admin/src/locales/lang/zh-CN/account.json +++ b/apps/admin/src/locales/lang/zh-CN/account.json @@ -1,4 +1,5 @@ { + "menu": "账户菜单:{name}", "eyebrow": "账号设置", "profile": "个人信息", "description": "管理你的个人资料和登录安全。", diff --git a/apps/admin/src/locales/lang/zh-CN/layout.json b/apps/admin/src/locales/lang/zh-CN/layout.json index c5674101..b8f92083 100644 --- a/apps/admin/src/locales/lang/zh-CN/layout.json +++ b/apps/admin/src/locales/lang/zh-CN/layout.json @@ -30,6 +30,7 @@ "restoreButton": "退出全屏", "loading": "正在加载", "tab": "布局", + "closeMenu": "关闭导航菜单", "toggleMenu": "打开导航菜单", "language": "切换语言" } diff --git a/apps/admin/src/locales/lang/zh-CN/preferences.json b/apps/admin/src/locales/lang/zh-CN/preferences.json index cd2b3f86..c0ed6ed1 100644 --- a/apps/admin/src/locales/lang/zh-CN/preferences.json +++ b/apps/admin/src/locales/lang/zh-CN/preferences.json @@ -154,6 +154,8 @@ "spacious": "舒适间距", "compact": "紧凑间距", "reading": "居中阅读", + "current": "当前", + "custom": "自定义间距", "focus": "专注工作", "maximize": "内容区最大化", "maximizeHint": "临时隐藏导航和页脚。关闭设置抽屉后可查看效果,按 Esc 或点击退出按钮恢复;刷新页面不保留。" diff --git a/apps/admin/src/views/dashboard/index.scss b/apps/admin/src/views/dashboard/index.scss index af2b694e..55e02e85 100644 --- a/apps/admin/src/views/dashboard/index.scss +++ b/apps/admin/src/views/dashboard/index.scss @@ -3,16 +3,38 @@ display: flex; flex-direction: column; gap: 24px; - width: 100%; - max-width: 1360px; + inline-size: 100%; + max-inline-size: 1360px; margin-inline: auto; padding-block: 8px 20px; + &__header { + padding: 28px 32px; + border: 1px solid var(--r-line); + border-radius: var(--r-radius); + background: color-mix( + in srgb, + var(--r-theme-primary-color) 5%, + var(--r-surface) + ); + + .r-page-header__eyebrow { + color: var(--r-primary-text); + } + } + + &__section-title { + margin-block-end: 12px; + color: var(--r-text); + font-size: 15px; + font-weight: 600; + } + &__brand { display: grid; place-items: center; - width: 72px; - height: 72px; + inline-size: 72px; + block-size: 72px; border: 1px solid var(--r-line); border-radius: var(--r-radius); background: var(--r-surface); @@ -33,6 +55,7 @@ border: 1px solid var(--r-line); border-radius: var(--r-radius); background: var(--r-surface); + min-inline-size: 0; } span { color: var(--r-text-secondary); @@ -44,6 +67,7 @@ font-size: 21px; font-weight: 600; letter-spacing: -0.03em; + overflow-wrap: anywhere; } small { color: var(--r-text-muted); @@ -65,32 +89,36 @@ border: 1px solid var(--r-line); border-radius: var(--r-control-radius); color: var(--r-text); - background: var(--r-surface-muted); + background: var(--r-surface); text-decoration: none; transition: border-color 0.18s ease, background-color 0.18s ease; &:hover { - border-color: var(--r-control-border); - background: var(--r-surface); + border-color: var(--r-primary-text); + background: var(--r-surface-muted); } &__icon { display: grid; place-items: center; - width: 38px; - height: 38px; + inline-size: 40px; + block-size: 40px; flex-shrink: 0; - border: 1px solid var(--r-line); border-radius: var(--r-control-radius); - color: var(--r-text-secondary); - background: var(--r-surface); + color: var(--r-primary-text); + background: color-mix( + in srgb, + var(--r-theme-primary-color) 9%, + var(--r-surface) + ); } - > span:nth-child(2) { + &__copy { display: flex; flex-direction: column; gap: 5px; - min-width: 0; + min-inline-size: 0; + overflow-wrap: anywhere; } strong { font-size: 14px; @@ -101,9 +129,14 @@ font-size: 12px; } &__arrow { + flex-shrink: 0; margin-inline-start: auto; color: var(--r-text-muted); } + + @media (prefers-reduced-motion: reduce) { + transition: none; + } } .r-dashboard-info { @@ -123,7 +156,7 @@ line-height: 1.8; } a { - color: var(--r-text); + color: var(--r-primary-text); text-underline-offset: 3px; } } @@ -157,11 +190,15 @@ } @container (max-width: 600px) { + .r-dashboard__header { + padding: 20px; + } .r-dashboard-stack { gap: 12px; } .r-dashboard-stack__item { - padding: 18px; + gap: 8px; + padding: 16px; } .r-dashboard__brand { display: none; diff --git a/apps/admin/src/views/dashboard/index.tsx b/apps/admin/src/views/dashboard/index.tsx index b7563654..285f5f99 100644 --- a/apps/admin/src/views/dashboard/index.tsx +++ b/apps/admin/src/views/dashboard/index.tsx @@ -14,6 +14,7 @@ export default defineComponent({ const { t } = useI18n('dashboard') const text = (key: string) => t(key) const { getMenuOptions } = useMenuGetters() + const shortcutsTitle = useId() const { dependencies, devDependencies } = __APP_CFG__.pkg const stack = [ { name: 'Vue', version: dependencies.vue, detail: 'Composition API' }, @@ -38,7 +39,7 @@ export default defineComponent({ }, { path: '/layout-demo', - icon: 'navigation/menu', + icon: 'navigation/layout', title: 'layout', description: 'layoutDescription', }, @@ -70,6 +71,7 @@ export default defineComponent({ return () => (
{shortcuts.value.length ? ( - -
+
+

+ {text('explore')} +

+
-
+ +
) : null}
diff --git a/apps/admin/src/views/user-management/index.scss b/apps/admin/src/views/user-management/index.scss index ecb73095..c67e788f 100644 --- a/apps/admin/src/views/user-management/index.scss +++ b/apps/admin/src/views/user-management/index.scss @@ -60,9 +60,36 @@ .n-data-table-base-body { overscroll-behavior: contain; } - &--stacked &__list { + &--stacked { block-size: auto; - min-block-size: 100%; + gap: 20px; + + > .n-spin-container { + flex: none; + } + + > .n-spin-container > .n-spin-content { + block-size: auto; + } + + .user-management__layout, + .user-management__list-viewport, + .user-management__list { + block-size: auto; + } + + .user-management__organization { + max-block-size: 18rem; + } + + .user-management__list-viewport > .n-scrollbar-container, + .n-data-table-base-body { + overscroll-behavior-y: auto; + } + + .user-management__list-viewport > .n-scrollbar-container { + block-size: auto; + } } &--stacked &__list > .r-table { flex: none; @@ -124,7 +151,8 @@ @container (max-width: 850px) { .user-management__layout { grid-template-columns: minmax(0, 1fr); - grid-template-rows: minmax(100px, 1fr) minmax(0, 3fr); + grid-template-rows: auto auto; + gap: 16px; } } @media (max-width: 600px) { diff --git a/apps/docs/guide/layout.md b/apps/docs/guide/layout.md index 4ae94e1e..eb5b94cc 100644 --- a/apps/docs/guide/layout.md +++ b/apps/docs/guide/layout.md @@ -31,7 +31,9 @@ updateSettingState('layoutConfig', { }) ``` -最大宽度范围是 640–2560px,间距为 0–48px。顶栏和页脚可固定或随内容滚动。设置抽屉默认使用舒适间距(24px),并提供紧凑和居中阅读预设,只调整内容宽度与间距,保留导航方式和固定栏配置。已有浏览器偏好继续沿用,恢复默认布局时应用新的默认间距。内容区最大化复用 `useMaximize`,关闭设置后可查看效果,按 Esc 或退出按钮恢复;这一状态不随刷新保留。旧设置补齐默认值,布局恢复默认只重置 `layoutConfig`。 +最大宽度范围是 640–2560px,间距为 0–48px。顶栏和页脚可固定或随内容滚动。设置抽屉默认使用舒适间距(24px),并提供紧凑和居中阅读预设,只调整内容宽度与间距,保留导航方式和固定栏配置。当前预设和实际间距会显示在预设区域;手动配置不匹配预设时显示「自定义间距」,不会覆盖已有设置。已有浏览器偏好继续沿用,恢复默认布局时应用新的默认间距。旧设置补齐默认值,布局恢复默认只重置 `layoutConfig`。 + +内容区最大化复用 `useMaximize`,关闭设置后可查看效果。窄屏的退出按钮固定悬浮在右上角,不占内容空间。点击按钮或按 Esc 即可恢复;最大化状态不随刷新保留。 外观页可批量显示或隐藏面包屑、页面标签和页脚,页面切换动画在「窗口与动效」中选择。各效果进入用时 240ms,退出用时 190ms,完整退出后再进入,并保留小幅位移和缩放。系统偏好减少动态效果时直接切换。恢复外观默认只重置外观选项,保留当前明暗模式。水印页提供疏朗、紧凑和水平预设、独立局部预览,以及应用标题和账户昵称快捷填入;无需开启全屏水印即可调试样式,预设保留已有文本和显隐状态。各模块的恢复按钮只作用于对应模块。 @@ -61,6 +63,6 @@ updateSettingState('layoutConfig', { ## 最近访问和收藏 -桌面搜索支持 Ctrl/Command + K。输入页面名称查找,点击星标收藏;空关键词时显示收藏与最近访问,方向键、回车和 Tab 可操作。记录按会话用户 id 隔离,刷新后恢复;清空记录保留收藏,也可在「偏好设置 → 通用」确认后清理当前账户的最近访问。缓存只存菜单路径,展示时重新依据当前菜单和权限筛选,语言切换沿用当前翻译。窄屏继续使用导航抽屉。 +桌面搜索支持 Ctrl/Command + K。输入页面名称查找,点击星标收藏;空关键词时显示收藏与最近访问,方向键、回车和 Tab 可操作。记录按会话用户 id 隔离,刷新后恢复;清空记录保留收藏,也可在「偏好设置 → 通用」确认后清理当前账户的最近访问。缓存只存菜单路径,展示时重新依据当前菜单和权限筛选,语言切换沿用当前翻译。手机也可通过顶栏搜索按钮查询、收藏和打开页面;导航抽屉提供关闭按钮,切换屏幕宽度保留桌面侧栏的折叠偏好。 -内容页需要撑满工作区时,先复用布局的 `--layout-content-height`、`RTablePro autoHeight` 和 `--r-table-height`,以及 Naive UI 的 `NCard contentScrollable` / `NScrollbar`。父容器提供确定高度,Flex/Grid 子项设置 `min-block-size: 0` 后再承载内部滚动;单纯填充与滚动无需新增通用组件。用户管理页展示了左右独立滚动与窄屏上下排布。 +内容页需要撑满工作区时,先复用布局的 `--layout-content-height`、`RTablePro autoHeight` 和 `--r-table-height`,以及 Naive UI 的 `NCard contentScrollable` / `NScrollbar`。父容器提供确定高度,Flex/Grid 子项设置 `min-block-size: 0` 后再承载内部滚动;单纯填充与滚动无需新增通用组件。用户管理页在桌面左右独立滚动;窄屏改为纵向页面滚动,组织树限制高度,表格保留局部横向滚动。 diff --git a/packages/admin-shell/src/AdminShell.tsx b/packages/admin-shell/src/AdminShell.tsx index f1f55121..93359e9f 100644 --- a/packages/admin-shell/src/AdminShell.tsx +++ b/packages/admin-shell/src/AdminShell.tsx @@ -153,6 +153,23 @@ export const AdminShell = defineComponent({ ]} style={props.maximized ? props.maximizedStyle : void 0} > + {props.maximized ? ( + + ) : null} {slots.loading?.()} - {props.maximized ? ( - - ) : null}
{config.fixedFooter ? footer() : null} diff --git a/packages/admin-shell/src/shell.scss b/packages/admin-shell/src/shell.scss index 2e968eb8..6c6bff58 100644 --- a/packages/admin-shell/src/shell.scss +++ b/packages/admin-shell/src/shell.scss @@ -90,23 +90,41 @@ place-items: center; inline-size: 36px; block-size: 36px; - border: 1px solid var(--r-control-border); - border-radius: var(--r-control-radius); - color: var(--r-text); + padding: 0; + border: 1px solid var(--r-line); + border-radius: 50%; + color: var(--r-text-secondary); background: var(--r-surface); + box-shadow: var(--r-shadow-soft); cursor: pointer; &:hover { + color: var(--r-text); background: var(--r-surface-hover); } } @media (max-width: 768px) { - .r-layout-full .r-layout-content-inner { - --layout-content-gutter: min( - var(--layout-content-padding), - clamp(10px, 4vw, 16px) - ); + .r-layout-full { + .r-layout-content-inner { + --layout-content-gutter: min( + var(--layout-content-padding), + clamp(10px, 4vw, 16px) + ); + } + + .r-layout-content--maximized { + .r-layout-content-scroll { + padding-inline-end: 0; + } + + .r-layout-content-restore__button { + inset-block-start: 6px; + inset-inline-end: 8px; + min-inline-size: 44px; + min-block-size: 44px; + } + } } }