30 changed files with 748 additions and 865 deletions
@ -0,0 +1,22 @@ |
|||||||
|
import { Sheet, SheetContent } from '@/components/ui/sheet' |
||||||
|
import NotePage from '@/pages/secondary/NotePage' |
||||||
|
|
||||||
|
interface NoteDrawerProps { |
||||||
|
open: boolean |
||||||
|
onOpenChange: (open: boolean) => void |
||||||
|
noteId: string | null |
||||||
|
} |
||||||
|
|
||||||
|
export default function NoteDrawer({ open, onOpenChange, noteId }: NoteDrawerProps) { |
||||||
|
if (!noteId) return null |
||||||
|
|
||||||
|
return ( |
||||||
|
<Sheet open={open} onOpenChange={onOpenChange}> |
||||||
|
<SheetContent side="right" className="w-full sm:max-w-[1042px] overflow-y-auto p-0"> |
||||||
|
<div className="h-full"> |
||||||
|
<NotePage id={noteId} index={0} hideTitlebar={false} /> |
||||||
|
</div> |
||||||
|
</SheetContent> |
||||||
|
</Sheet> |
||||||
|
) |
||||||
|
} |
||||||
@ -0,0 +1,37 @@ |
|||||||
|
import { Button } from '@/components/ui/button' |
||||||
|
import { useScreenSize } from '@/providers/ScreenSizeProvider' |
||||||
|
import storage from '@/services/local-storage.service' |
||||||
|
import { PanelLeft, PanelsLeftRight } from 'lucide-react' |
||||||
|
import { useState } from 'react' |
||||||
|
|
||||||
|
export default function PaneModeToggle() { |
||||||
|
const { isSmallScreen } = useScreenSize() |
||||||
|
const [panelMode, setPanelMode] = useState<'single' | 'double'>(() => storage.getPanelMode()) |
||||||
|
|
||||||
|
// Hide on mobile
|
||||||
|
if (isSmallScreen) return null |
||||||
|
|
||||||
|
const toggleMode = () => { |
||||||
|
const newMode = panelMode === 'single' ? 'double' : 'single' |
||||||
|
setPanelMode(newMode) |
||||||
|
storage.setPanelMode(newMode) |
||||||
|
} |
||||||
|
|
||||||
|
return ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="flex shadow-none items-center transition-colors duration-500 bg-transparent w-12 h-12 xl:w-full xl:h-auto p-3 m-0 xl:py-2 xl:px-3 rounded-lg xl:justify-start gap-4 text-lg font-semibold [&_svg]:size-full xl:[&_svg]:size-4" |
||||||
|
title={panelMode === 'single' ? 'Switch to double-pane mode' : 'Switch to single-pane mode'} |
||||||
|
onClick={toggleMode} |
||||||
|
> |
||||||
|
{panelMode === 'single' ? ( |
||||||
|
<PanelLeft strokeWidth={3} /> |
||||||
|
) : ( |
||||||
|
<PanelsLeftRight strokeWidth={3} /> |
||||||
|
)} |
||||||
|
<div className="max-xl:hidden"> |
||||||
|
{panelMode === 'single' ? 'Single-pane' : 'Double-pane'} |
||||||
|
</div> |
||||||
|
</Button> |
||||||
|
) |
||||||
|
} |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
import { Button } from '@/components/ui/button' |
||||||
|
import { useScreenSize } from '@/providers/ScreenSizeProvider' |
||||||
|
import storage from '@/services/local-storage.service' |
||||||
|
import { PanelLeft, PanelsLeftRight } from 'lucide-react' |
||||||
|
import { useState } from 'react' |
||||||
|
|
||||||
|
export default function PaneModeToggle() { |
||||||
|
const { isSmallScreen } = useScreenSize() |
||||||
|
const [panelMode, setPanelMode] = useState<'single' | 'double'>(() => storage.getPanelMode()) |
||||||
|
|
||||||
|
// Hide on mobile
|
||||||
|
if (isSmallScreen) return null |
||||||
|
|
||||||
|
const toggleMode = () => { |
||||||
|
const newMode = panelMode === 'single' ? 'double' : 'single' |
||||||
|
setPanelMode(newMode) |
||||||
|
storage.setPanelMode(newMode) |
||||||
|
// Dispatch event to notify PageManager of the change
|
||||||
|
window.dispatchEvent(new CustomEvent('panelModeChanged', { detail: { mode: newMode } })) |
||||||
|
} |
||||||
|
|
||||||
|
return ( |
||||||
|
<Button |
||||||
|
variant="ghost" |
||||||
|
className="flex shadow-none items-center transition-colors duration-500 bg-transparent w-12 h-12 xl:w-full xl:h-auto p-3 m-0 xl:py-2 xl:px-3 rounded-lg xl:justify-start gap-4 text-lg font-semibold [&_svg]:size-full xl:[&_svg]:size-4" |
||||||
|
title={panelMode === 'single' ? 'Switch to double-pane mode' : 'Switch to single-pane mode'} |
||||||
|
onClick={toggleMode} |
||||||
|
> |
||||||
|
{panelMode === 'single' ? ( |
||||||
|
<PanelLeft strokeWidth={3} /> |
||||||
|
) : ( |
||||||
|
<PanelsLeftRight strokeWidth={3} /> |
||||||
|
)} |
||||||
|
<div className="max-xl:hidden"> |
||||||
|
{panelMode === 'single' ? 'Single-pane' : 'Double-pane'} |
||||||
|
</div> |
||||||
|
</Button> |
||||||
|
) |
||||||
|
} |
||||||
Loading…
Reference in new issue