-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da1bfaf
commit 364e4cd
Showing
8 changed files
with
167 additions
and
219 deletions.
There are no files selected for viewing
90 changes: 38 additions & 52 deletions
90
packages/react/src/components/floating-panel/examples/basic.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,45 @@ | ||
import { | ||
FloatingPanel, | ||
FloatingPanelBody, | ||
FloatingPanelCloseTrigger, | ||
FloatingPanelContent, | ||
FloatingPanelDragTrigger, | ||
FloatingPanelHeader, | ||
FloatingPanelMaximizeTrigger, | ||
FloatingPanelMinimizeTrigger, | ||
FloatingPanelPositioner, | ||
FloatingPanelResizeTrigger, | ||
FloatingPanelRestoreTrigger, | ||
FloatingPanelTitle, | ||
FloatingPanelTrigger, | ||
Portal, | ||
} from '../..' | ||
|
||
import { ArrowDownLeft, Maximize2, Minus, XIcon } from 'lucide-react' | ||
import { FloatingPanel, Portal } from '../..' | ||
|
||
export const Basic = () => ( | ||
<FloatingPanel.Root> | ||
<FloatingPanelTrigger>Toggle Panel</FloatingPanelTrigger> | ||
<FloatingPanelPositioner> | ||
<FloatingPanelContent> | ||
<FloatingPanelDragTrigger> | ||
<FloatingPanelHeader> | ||
<FloatingPanelTitle>Floating Panel</FloatingPanelTitle> | ||
<div data-scope="floating-panel" data-part="trigger-group"> | ||
<FloatingPanelMinimizeTrigger> | ||
<Minus /> | ||
</FloatingPanelMinimizeTrigger> | ||
<FloatingPanelMaximizeTrigger> | ||
<Maximize2 /> | ||
</FloatingPanelMaximizeTrigger> | ||
<FloatingPanelRestoreTrigger> | ||
<ArrowDownLeft /> | ||
</FloatingPanelRestoreTrigger> | ||
<FloatingPanelCloseTrigger> | ||
<XIcon /> | ||
</FloatingPanelCloseTrigger> | ||
</div> | ||
</FloatingPanelHeader> | ||
</FloatingPanelDragTrigger> | ||
<FloatingPanelBody> | ||
<p>Some content</p> | ||
</FloatingPanelBody> | ||
<FloatingPanel.Trigger>Toggle Panel</FloatingPanel.Trigger> | ||
<Portal> | ||
<FloatingPanel.Positioner> | ||
<FloatingPanel.Content> | ||
<FloatingPanel.DragTrigger> | ||
<FloatingPanel.Header> | ||
<FloatingPanel.Title>Floating Panel</FloatingPanel.Title> | ||
<div data-scope="floating-panel" data-part="trigger-group"> | ||
<FloatingPanel.MinimizeTrigger> | ||
<Minus /> | ||
</FloatingPanel.MinimizeTrigger> | ||
<FloatingPanel.MaximizeTrigger> | ||
<Maximize2 /> | ||
</FloatingPanel.MaximizeTrigger> | ||
<FloatingPanel.RestoreTrigger> | ||
<ArrowDownLeft /> | ||
</FloatingPanel.RestoreTrigger> | ||
<FloatingPanel.CloseTrigger> | ||
<XIcon /> | ||
</FloatingPanel.CloseTrigger> | ||
</div> | ||
</FloatingPanel.Header> | ||
</FloatingPanel.DragTrigger> | ||
<FloatingPanel.Body> | ||
<p>Some content</p> | ||
</FloatingPanel.Body> | ||
|
||
<FloatingPanelResizeTrigger axis="n" /> | ||
<FloatingPanelResizeTrigger axis="e" /> | ||
<FloatingPanelResizeTrigger axis="w" /> | ||
<FloatingPanelResizeTrigger axis="s" /> | ||
<FloatingPanelResizeTrigger axis="ne" /> | ||
<FloatingPanelResizeTrigger axis="se" /> | ||
<FloatingPanelResizeTrigger axis="sw" /> | ||
<FloatingPanelResizeTrigger axis="nw" /> | ||
</FloatingPanelContent> | ||
</FloatingPanelPositioner> | ||
<FloatingPanel.ResizeTrigger axis="n" /> | ||
<FloatingPanel.ResizeTrigger axis="e" /> | ||
<FloatingPanel.ResizeTrigger axis="w" /> | ||
<FloatingPanel.ResizeTrigger axis="s" /> | ||
<FloatingPanel.ResizeTrigger axis="ne" /> | ||
<FloatingPanel.ResizeTrigger axis="se" /> | ||
<FloatingPanel.ResizeTrigger axis="sw" /> | ||
<FloatingPanel.ResizeTrigger axis="nw" /> | ||
</FloatingPanel.Content> | ||
</FloatingPanel.Positioner> | ||
</Portal> | ||
</FloatingPanel.Root> | ||
) |
76 changes: 30 additions & 46 deletions
76
packages/react/src/components/floating-panel/examples/controlled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 29 additions & 44 deletions
73
packages/react/src/components/floating-panel/examples/lazy-mount.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,46 @@ | ||
import { | ||
FloatingPanel, | ||
FloatingPanelBody, | ||
FloatingPanelCloseTrigger, | ||
FloatingPanelContent, | ||
FloatingPanelDragTrigger, | ||
FloatingPanelHeader, | ||
FloatingPanelMaximizeTrigger, | ||
FloatingPanelMinimizeTrigger, | ||
FloatingPanelPositioner, | ||
FloatingPanelResizeTrigger, | ||
FloatingPanelRestoreTrigger, | ||
FloatingPanelTitle, | ||
FloatingPanelTrigger, | ||
Portal, | ||
} from '../..' | ||
import { FloatingPanel, Portal } from '../..' | ||
|
||
import { ArrowDownLeft, Maximize2, Minus, XIcon } from 'lucide-react' | ||
|
||
export const LazyMount = () => ( | ||
<FloatingPanel.Root lazyMount onExitComplete={() => console.log('onExitComplete invoked')}> | ||
<FloatingPanelTrigger>Toggle Panel</FloatingPanelTrigger> | ||
<FloatingPanel.Trigger>Toggle Panel</FloatingPanel.Trigger> | ||
<Portal> | ||
<FloatingPanelPositioner> | ||
<FloatingPanelContent> | ||
<FloatingPanelDragTrigger> | ||
<FloatingPanelHeader> | ||
<FloatingPanelTitle>Floating Panel</FloatingPanelTitle> | ||
<FloatingPanel.Positioner> | ||
<FloatingPanel.Content> | ||
<FloatingPanel.DragTrigger> | ||
<FloatingPanel.Header> | ||
<FloatingPanel.Title>Floating Panel</FloatingPanel.Title> | ||
<div data-scope="floating-panel" data-part="trigger-group"> | ||
<FloatingPanelMinimizeTrigger> | ||
<FloatingPanel.MinimizeTrigger> | ||
<Minus /> | ||
</FloatingPanelMinimizeTrigger> | ||
<FloatingPanelMaximizeTrigger> | ||
</FloatingPanel.MinimizeTrigger> | ||
<FloatingPanel.MaximizeTrigger> | ||
<Maximize2 /> | ||
</FloatingPanelMaximizeTrigger> | ||
<FloatingPanelRestoreTrigger> | ||
</FloatingPanel.MaximizeTrigger> | ||
<FloatingPanel.RestoreTrigger> | ||
<ArrowDownLeft /> | ||
</FloatingPanelRestoreTrigger> | ||
<FloatingPanelCloseTrigger> | ||
</FloatingPanel.RestoreTrigger> | ||
<FloatingPanel.CloseTrigger> | ||
<XIcon /> | ||
</FloatingPanelCloseTrigger> | ||
</FloatingPanel.CloseTrigger> | ||
</div> | ||
</FloatingPanelHeader> | ||
</FloatingPanelDragTrigger> | ||
<FloatingPanelBody> | ||
</FloatingPanel.Header> | ||
</FloatingPanel.DragTrigger> | ||
<FloatingPanel.Body> | ||
<p>Some content</p> | ||
</FloatingPanelBody> | ||
</FloatingPanel.Body> | ||
|
||
<FloatingPanelResizeTrigger axis="n" /> | ||
<FloatingPanelResizeTrigger axis="e" /> | ||
<FloatingPanelResizeTrigger axis="w" /> | ||
<FloatingPanelResizeTrigger axis="s" /> | ||
<FloatingPanelResizeTrigger axis="ne" /> | ||
<FloatingPanelResizeTrigger axis="se" /> | ||
<FloatingPanelResizeTrigger axis="sw" /> | ||
<FloatingPanelResizeTrigger axis="nw" /> | ||
</FloatingPanelContent> | ||
</FloatingPanelPositioner> | ||
<FloatingPanel.ResizeTrigger axis="n" /> | ||
<FloatingPanel.ResizeTrigger axis="e" /> | ||
<FloatingPanel.ResizeTrigger axis="w" /> | ||
<FloatingPanel.ResizeTrigger axis="s" /> | ||
<FloatingPanel.ResizeTrigger axis="ne" /> | ||
<FloatingPanel.ResizeTrigger axis="se" /> | ||
<FloatingPanel.ResizeTrigger axis="sw" /> | ||
<FloatingPanel.ResizeTrigger axis="nw" /> | ||
</FloatingPanel.Content> | ||
</FloatingPanel.Positioner> | ||
</Portal> | ||
</FloatingPanel.Root> | ||
) |
81 changes: 32 additions & 49 deletions
81
packages/react/src/components/floating-panel/examples/render-fn.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,48 @@ | ||
import { | ||
FloatingPanel, | ||
FloatingPanelBody, | ||
FloatingPanelCloseTrigger, | ||
FloatingPanelContent, | ||
FloatingPanelContext, | ||
FloatingPanelDragTrigger, | ||
FloatingPanelHeader, | ||
FloatingPanelMaximizeTrigger, | ||
FloatingPanelMinimizeTrigger, | ||
FloatingPanelPositioner, | ||
FloatingPanelResizeTrigger, | ||
FloatingPanelRestoreTrigger, | ||
FloatingPanelTitle, | ||
FloatingPanelTrigger, | ||
Portal, | ||
} from '../..' | ||
|
||
import { ArrowDownLeft, Maximize2, Minus, XIcon } from 'lucide-react' | ||
import { FloatingPanel, Portal } from '../..' | ||
|
||
export const RenderFn = () => ( | ||
<FloatingPanel.Root> | ||
<FloatingPanelTrigger>Toggle Panel</FloatingPanelTrigger> | ||
<FloatingPanel.Trigger>Toggle Panel</FloatingPanel.Trigger> | ||
<Portal> | ||
<FloatingPanelPositioner> | ||
<FloatingPanelContent> | ||
<FloatingPanelDragTrigger> | ||
<FloatingPanelHeader> | ||
<FloatingPanelTitle>Floating Panel</FloatingPanelTitle> | ||
<FloatingPanel.Positioner> | ||
<FloatingPanel.Content> | ||
<FloatingPanel.DragTrigger> | ||
<FloatingPanel.Header> | ||
<FloatingPanel.Title>Floating Panel</FloatingPanel.Title> | ||
<div data-scope="floating-panel" data-part="trigger-group"> | ||
<FloatingPanelMinimizeTrigger> | ||
<FloatingPanel.MinimizeTrigger> | ||
<Minus /> | ||
</FloatingPanelMinimizeTrigger> | ||
<FloatingPanelMaximizeTrigger> | ||
</FloatingPanel.MinimizeTrigger> | ||
<FloatingPanel.MaximizeTrigger> | ||
<Maximize2 /> | ||
</FloatingPanelMaximizeTrigger> | ||
<FloatingPanelRestoreTrigger> | ||
</FloatingPanel.MaximizeTrigger> | ||
<FloatingPanel.RestoreTrigger> | ||
<ArrowDownLeft /> | ||
</FloatingPanelRestoreTrigger> | ||
<FloatingPanelCloseTrigger> | ||
</FloatingPanel.RestoreTrigger> | ||
<FloatingPanel.CloseTrigger> | ||
<XIcon /> | ||
</FloatingPanelCloseTrigger> | ||
</FloatingPanel.CloseTrigger> | ||
</div> | ||
</FloatingPanelHeader> | ||
</FloatingPanelDragTrigger> | ||
<FloatingPanelBody> | ||
</FloatingPanel.Header> | ||
</FloatingPanel.DragTrigger> | ||
<FloatingPanel.Body> | ||
<p>Some content</p> | ||
</FloatingPanelBody> | ||
</FloatingPanel.Body> | ||
|
||
<FloatingPanelResizeTrigger axis="n" /> | ||
<FloatingPanelResizeTrigger axis="e" /> | ||
<FloatingPanelResizeTrigger axis="w" /> | ||
<FloatingPanelResizeTrigger axis="s" /> | ||
<FloatingPanelResizeTrigger axis="ne" /> | ||
<FloatingPanelResizeTrigger axis="se" /> | ||
<FloatingPanelResizeTrigger axis="sw" /> | ||
<FloatingPanelResizeTrigger axis="nw" /> | ||
</FloatingPanelContent> | ||
</FloatingPanelPositioner> | ||
<FloatingPanel.ResizeTrigger axis="n" /> | ||
<FloatingPanel.ResizeTrigger axis="e" /> | ||
<FloatingPanel.ResizeTrigger axis="w" /> | ||
<FloatingPanel.ResizeTrigger axis="s" /> | ||
<FloatingPanel.ResizeTrigger axis="ne" /> | ||
<FloatingPanel.ResizeTrigger axis="se" /> | ||
<FloatingPanel.ResizeTrigger axis="sw" /> | ||
<FloatingPanel.ResizeTrigger axis="nw" /> | ||
</FloatingPanel.Content> | ||
</FloatingPanel.Positioner> | ||
</Portal> | ||
<FloatingPanelContext> | ||
{(floatingPanel) => <p>floatingPanel is {floatingPanel.open ? 'open' : 'closed'}</p>} | ||
</FloatingPanelContext> | ||
<FloatingPanel.Context> | ||
{(floatingPanel) => <p>floatingPanel. is {floatingPanel.open ? 'open' : 'closed'}</p>} | ||
</FloatingPanel.Context> | ||
</FloatingPanel.Root> | ||
) |
Oops, something went wrong.