♻️(frontend) collapse tabs when modal is not wide
Inspired by Gmeet UX. Styling of the icon-only tabs should be enhanced. Heavily rely on JS, which is quite sad for this simple responsive layout.
This commit is contained in:
committed by
aleb_the_flash
parent
57bba04cf3
commit
c4ececd03a
@@ -12,6 +12,8 @@ import {
|
|||||||
import { AccountTab } from './tabs/AccountTab'
|
import { AccountTab } from './tabs/AccountTab'
|
||||||
import { GeneralTab } from '@/features/settings/components/tabs/GeneralTab.tsx'
|
import { GeneralTab } from '@/features/settings/components/tabs/GeneralTab.tsx'
|
||||||
import { AudioTab } from '@/features/settings/components/tabs/AudioTab.tsx'
|
import { AudioTab } from '@/features/settings/components/tabs/AudioTab.tsx'
|
||||||
|
import { useSize } from '@/features/rooms/livekit/hooks/useResizeObserver'
|
||||||
|
import { useRef } from 'react'
|
||||||
|
|
||||||
const tabsStyle = css({
|
const tabsStyle = css({
|
||||||
maxHeight: '40.625rem', // fixme size copied from meet settings modal
|
maxHeight: '40.625rem', // fixme size copied from meet settings modal
|
||||||
@@ -28,7 +30,6 @@ const tabListContainerStyle = css({
|
|||||||
borderRight: '1px solid lightGray', // fixme poor color management
|
borderRight: '1px solid lightGray', // fixme poor color management
|
||||||
paddingY: '1rem',
|
paddingY: '1rem',
|
||||||
paddingRight: '1.5rem',
|
paddingRight: '1.5rem',
|
||||||
flex: '0 0 16rem', // fixme size copied from meet settings modal
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const tabPanelContainerStyle = css({
|
const tabPanelContainerStyle = css({
|
||||||
@@ -45,25 +46,39 @@ export type SettingsDialogExtended = Pick<
|
|||||||
export const SettingsDialogExtended = (props: SettingsDialogExtended) => {
|
export const SettingsDialogExtended = (props: SettingsDialogExtended) => {
|
||||||
// display only icon on small screen
|
// display only icon on small screen
|
||||||
const { t } = useTranslation('settings')
|
const { t } = useTranslation('settings')
|
||||||
|
|
||||||
|
const dialogEl = useRef<HTMLDivElement>(null)
|
||||||
|
const { width } = useSize(dialogEl)
|
||||||
|
const isWideScreen = !width || width >= 800 // fixme - hardcoded 50rem in pixel
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog {...props} role="dialog" type="flex">
|
<Dialog innerRef={dialogEl} {...props} role="dialog" type="flex">
|
||||||
<Tabs orientation="vertical" className={tabsStyle}>
|
<Tabs orientation="vertical" className={tabsStyle}>
|
||||||
<div className={tabListContainerStyle}>
|
<div
|
||||||
<Heading slot="title" level={1} className={text({ variant: 'h1' })}>
|
className={tabListContainerStyle}
|
||||||
{t('dialog.heading')}
|
style={{
|
||||||
</Heading>
|
flex: isWideScreen ? '0 0 16rem' : undefined,
|
||||||
|
paddingTop: !isWideScreen ? '64px' : undefined,
|
||||||
|
paddingRight: !isWideScreen ? '1rem' : undefined,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isWideScreen && (
|
||||||
|
<Heading slot="title" level={1} className={text({ variant: 'h1' })}>
|
||||||
|
{t('dialog.heading')}
|
||||||
|
</Heading>
|
||||||
|
)}
|
||||||
<TabList border={false} aria-label="Chat log orientation example">
|
<TabList border={false} aria-label="Chat log orientation example">
|
||||||
<Tab icon highlight id="1">
|
<Tab icon highlight id="1">
|
||||||
<RiAccountCircleLine />
|
<RiAccountCircleLine />
|
||||||
{t('tabs.account')}
|
{isWideScreen && t('tabs.account')}
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab icon highlight id="2">
|
<Tab icon highlight id="2">
|
||||||
<RiSpeakerLine />
|
<RiSpeakerLine />
|
||||||
{t('tabs.audio')}
|
{isWideScreen && t('tabs.audio')}
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab icon highlight id="3">
|
<Tab icon highlight id="3">
|
||||||
<RiSettings3Line />
|
<RiSettings3Line />
|
||||||
{t('tabs.general')}
|
{isWideScreen && t('tabs.general')}
|
||||||
</Tab>
|
</Tab>
|
||||||
</TabList>
|
</TabList>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user