♻️(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 { GeneralTab } from '@/features/settings/components/tabs/GeneralTab.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({
|
||||
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
|
||||
paddingY: '1rem',
|
||||
paddingRight: '1.5rem',
|
||||
flex: '0 0 16rem', // fixme size copied from meet settings modal
|
||||
})
|
||||
|
||||
const tabPanelContainerStyle = css({
|
||||
@@ -45,25 +46,39 @@ export type SettingsDialogExtended = Pick<
|
||||
export const SettingsDialogExtended = (props: SettingsDialogExtended) => {
|
||||
// display only icon on small screen
|
||||
const { t } = useTranslation('settings')
|
||||
|
||||
const dialogEl = useRef<HTMLDivElement>(null)
|
||||
const { width } = useSize(dialogEl)
|
||||
const isWideScreen = !width || width >= 800 // fixme - hardcoded 50rem in pixel
|
||||
|
||||
return (
|
||||
<Dialog {...props} role="dialog" type="flex">
|
||||
<Dialog innerRef={dialogEl} {...props} role="dialog" type="flex">
|
||||
<Tabs orientation="vertical" className={tabsStyle}>
|
||||
<div className={tabListContainerStyle}>
|
||||
<Heading slot="title" level={1} className={text({ variant: 'h1' })}>
|
||||
{t('dialog.heading')}
|
||||
</Heading>
|
||||
<div
|
||||
className={tabListContainerStyle}
|
||||
style={{
|
||||
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">
|
||||
<Tab icon highlight id="1">
|
||||
<RiAccountCircleLine />
|
||||
{t('tabs.account')}
|
||||
{isWideScreen && t('tabs.account')}
|
||||
</Tab>
|
||||
<Tab icon highlight id="2">
|
||||
<RiSpeakerLine />
|
||||
{t('tabs.audio')}
|
||||
{isWideScreen && t('tabs.audio')}
|
||||
</Tab>
|
||||
<Tab icon highlight id="3">
|
||||
<RiSettings3Line />
|
||||
{t('tabs.general')}
|
||||
{isWideScreen && t('tabs.general')}
|
||||
</Tab>
|
||||
</TabList>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user