make move sidepanel one layer up, so tabs are at the top and the toggle doesn't float
This commit is contained in:
parent
9a10cac8e9
commit
bcce1fa68a
4 changed files with 32 additions and 11 deletions
|
|
@ -4,6 +4,7 @@ import cx from '@src/cx.mjs';
|
||||||
import { useSettings, setIsZen } from '../../settings.mjs';
|
import { useSettings, setIsZen } from '../../settings.mjs';
|
||||||
import { StrudelIcon } from '@src/repl/components/icons/StrudelIcon';
|
import { StrudelIcon } from '@src/repl/components/icons/StrudelIcon';
|
||||||
import '../Repl.css';
|
import '../Repl.css';
|
||||||
|
import { PanelToggle } from '@src/repl/components/panel/Panel';
|
||||||
|
|
||||||
const { BASE_URL } = import.meta.env;
|
const { BASE_URL } = import.meta.env;
|
||||||
const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
|
const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
|
||||||
|
|
@ -108,6 +109,7 @@ export function Header({ context, isEmbedded = false }) {
|
||||||
<span>learn</span>
|
<span>learn</span>
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
<PanelToggle isEmbedded={isEmbedded} isZen={isZen} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ export default function ReplEditor(Props) {
|
||||||
return (
|
return (
|
||||||
<div className="h-full flex flex-col relative" {...editorProps}>
|
<div className="h-full flex flex-col relative" {...editorProps}>
|
||||||
<Loader active={pending} />
|
<Loader active={pending} />
|
||||||
<Header context={context} isEmbedded={isEmbedded} />
|
<div className="grow flex justify-stretch w-full relative overflow-hidden">
|
||||||
|
<div className="flex flex-col grow overflow-hidden">
|
||||||
<div className="grow flex relative overflow-hidden">
|
<Header context={context} isEmbedded={isEmbedded} />
|
||||||
<Code containerRef={containerRef} editorRef={editorRef} init={init} />
|
<Code containerRef={containerRef} editorRef={editorRef} init={init} />
|
||||||
|
</div>
|
||||||
{!isZen && panelPosition === 'right' && <VerticalPanel context={context} />}
|
{!isZen && panelPosition === 'right' && <VerticalPanel context={context} />}
|
||||||
<PanelToggle isEmbedded={isEmbedded} isZen={isZen} />
|
|
||||||
</div>
|
</div>
|
||||||
<UserFacingErrorMessage error={error} />
|
<UserFacingErrorMessage error={error} />
|
||||||
{!isZen && panelPosition === 'bottom' && <HorizontalPanel context={context} />}
|
{!isZen && panelPosition === 'bottom' && <HorizontalPanel context={context} />}
|
||||||
|
|
|
||||||
19
website/src/repl/components/icons/SidebarIcon.jsx
Normal file
19
website/src/repl/components/icons/SidebarIcon.jsx
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
export function SidebarIcon() {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
class="lucide lucide-panel-right-icon lucide-panel-right"
|
||||||
|
>
|
||||||
|
<rect width="18" height="18" x="3" y="3" rx="2" />
|
||||||
|
<path d="M15 3v18" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ function PanelCloseButton() {
|
||||||
isPanelOpen && (
|
isPanelOpen && (
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsPanelOpened(false)}
|
onClick={() => setIsPanelOpened(false)}
|
||||||
className={cx('px-4 py-1 text-foreground hover:opacity-50')}
|
className={cx('px-2 py-0 text-foreground hover:opacity-50')}
|
||||||
aria-label="Close Menu"
|
aria-label="Close Menu"
|
||||||
>
|
>
|
||||||
<XMarkIcon className="w-6 h-6" />
|
<XMarkIcon className="w-6 h-6" />
|
||||||
|
|
@ -60,7 +60,7 @@ export function VerticalPanel({ context }) {
|
||||||
<PanelNav
|
<PanelNav
|
||||||
settings={settings}
|
settings={settings}
|
||||||
className={cx(
|
className={cx(
|
||||||
'border-l border-muted',
|
'border-l border-muted shrink-0',
|
||||||
isPanelOpen ? `min-w-[min(600px,100vw)] max-w-[min(600px,80vw)]` : 'min-w-12 max-w-12',
|
isPanelOpen ? `min-w-[min(600px,100vw)] max-w-[min(600px,80vw)]` : 'min-w-12 max-w-12',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|
@ -137,7 +137,7 @@ function PanelTab({ label, isSelected, onClick }) {
|
||||||
<button
|
<button
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
className={cx(
|
className={cx(
|
||||||
'h-8 px-2 text-xs text-foreground cursor-pointer hover:opacity-50 flex items-center space-x-1 border-b-2',
|
'h-10 px-2 text-sm border-t-2 border-t-transparent text-foreground cursor-pointer hover:opacity-50 flex items-center space-x-1 border-b-2',
|
||||||
isSelected ? 'border-foreground' : 'border-transparent',
|
isSelected ? 'border-foreground' : 'border-transparent',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|
@ -149,7 +149,7 @@ function PanelTab({ label, isSelected, onClick }) {
|
||||||
function Tabs({ className }) {
|
function Tabs({ className }) {
|
||||||
const { isPanelOpen, activeFooter: tab } = useSettings();
|
const { isPanelOpen, activeFooter: tab } = useSettings();
|
||||||
return (
|
return (
|
||||||
<div className={cx('w-full flex select-none max-w-full overflow-auto items-center', className)}>
|
<div className={cx('w-full flex select-none max-w-full h-10 overflow-auto items-center', className)}>
|
||||||
{Object.keys(tabNames).map((key) => {
|
{Object.keys(tabNames).map((key) => {
|
||||||
const val = tabNames[key];
|
const val = tabNames[key];
|
||||||
return <PanelTab key={key} isSelected={tab === val && isPanelOpen} label={key} onClick={() => setTab(val)} />;
|
return <PanelTab key={key} isSelected={tab === val && isPanelOpen} label={key} onClick={() => setTab(val)} />;
|
||||||
|
|
@ -167,12 +167,12 @@ export function PanelToggle({ isEmbedded, isZen }) {
|
||||||
<button
|
<button
|
||||||
title="share"
|
title="share"
|
||||||
className={cx(
|
className={cx(
|
||||||
'absolute top-0.5 right-3 rounded-0 px-2 py-2 bg-background z-[1000] cursor-pointer hover:opacity-80 flex justify-center items-center space-x-1 text-foreground ',
|
'ml-4 rounded-0 cursor-pointer hover:opacity-80 flex justify-center items-center space-x-1 text-foreground ',
|
||||||
isPanelOpen && 'hidden',
|
isPanelOpen && 'hidden',
|
||||||
)}
|
)}
|
||||||
onClick={() => setIsPanelOpened(!isPanelOpen)}
|
onClick={() => setIsPanelOpened(!isPanelOpen)}
|
||||||
>
|
>
|
||||||
<Bars3Icon className="w-6 h-6" />
|
<Bars3Icon className="w-5 h-5" />
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue