Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: now workspace settings and new page have a fixed footer for CTAs #2982

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 37 additions & 29 deletions components/Workspaces/WorkspaceLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ interface WorkspaceLayoutProps {
workspaceId: string;
banner?: React.ReactNode;
children: React.ReactNode;
footer?: React.ReactNode;
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
}

export const WorkspaceLayout = ({ workspaceId, banner, children }: WorkspaceLayoutProps) => {
export const WorkspaceLayout = ({ workspaceId, banner, children, footer }: WorkspaceLayoutProps) => {
const isLargeScreen = useMediaQuery("(min-width: 1024px)");
const [showingSidebar, setShowingSidebar] = useLocalStorage("showingSidebar", isLargeScreen);
const hideSidebar = () => setShowingSidebar(false);
Expand All @@ -36,34 +37,41 @@ export const WorkspaceLayout = ({ workspaceId, banner, children }: WorkspaceLayo
);

return (
<div
className="grid"
style={{
"--top-nav-height": "3.3rem",
gridTemplateRows: "var(--top-nav-height) auto 1fr",
minHeight: "calc(100vh - var(--top-nav-height))",
}}
>
<div>
<TopNav />
<ClientOnly>
<span ref={sidebarRef}>
<AppSideBar workspaceId={workspaceId} hideSidebar={hideSidebar} sidebarCollapsed={showingSidebar} />
</span>
{!showingSidebar && (
<button
onClick={() => setShowingSidebar(true)}
className="fixed z-50 border-8 border-solid border-black inset-x-0 top-16 w-fit bg-white rounded-r-md shadow-lg p-2"
>
<LuArrowRightToLine className="w-4 h-4 text-gray-500" />
</button>
)}
</ClientOnly>
<>
<div
className="grid"
style={{
"--top-nav-height": "3.3rem",
gridTemplateRows: "var(--top-nav-height) auto 1fr",
minHeight: "calc(100vh - var(--top-nav-height))",
}}
>
<div>
<TopNav />
<ClientOnly>
<span ref={sidebarRef}>
<AppSideBar workspaceId={workspaceId} hideSidebar={hideSidebar} sidebarCollapsed={showingSidebar} />
</span>
{!showingSidebar && (
<button
onClick={() => setShowingSidebar(true)}
className="fixed z-50 border-8 border-solid border-black inset-x-0 top-16 w-fit bg-white rounded-r-md shadow-lg p-2"
>
<LuArrowRightToLine className="w-4 h-4 text-gray-500" />
</button>
)}
</ClientOnly>
</div>
<div className="relative flex flex-col items-center grow pt-8 md:pt-14 lg:pt-20">
{banner}
<div className="px-1 sm:px-2 md:px-4 xl:px-16 container w-full min-h-[100px] pb-20">{children}</div>
</div>
</div>
<div className="relative flex flex-col items-center grow pt-8 md:pt-14 lg:pt-20">
{banner}
<div className="px-1 sm:px-2 md:px-4 xl:px-16 container w-full min-h-[100px]">{children}</div>
</div>
</div>
{footer ? (
<div className="sticky bottom-0 bg-light-slate-2 border-t h-16 pr-3 flex flex-col justify-center items-end">
<div className="border-t flex">{footer}</div>
</div>
) : null}
</>
);
};
18 changes: 8 additions & 10 deletions pages/workspaces/[workspaceId]/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,14 @@ const WorkspaceSettings = ({ workspace, canDeleteWorkspace }: WorkspaceSettingsP
};

return (
<WorkspaceLayout workspaceId={workspace.id}>
<WorkspaceLayout
workspaceId={workspace.id}
footer={
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
<Button variant="primary" className="flex gap-2.5 items-center cursor-pointer w-min sm:mt-0 self-end">
Update Workspace
</Button>
}
>
<WorkspaceHeader workspace={workspace} />
<div className="grid gap-6">
<div>
Expand All @@ -237,14 +244,6 @@ const WorkspaceSettings = ({ workspace, canDeleteWorkspace }: WorkspaceSettingsP
placeholder="Workspace description"
className="w-full md:w-3/4 max-w-lg"
/>
<div className="bg-white sticky-bottom fixed rounded-lg bottom-4 right-0 self-end m-6">
<Button
variant="primary"
className="z-50 flex gap-2.5 items-center cursor-pointer w-min sm:mt-0 self-end"
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
>
Update Workspace
</Button>
</div>
</form>
</div>
<TrackedReposTable
Expand Down Expand Up @@ -278,7 +277,6 @@ const WorkspaceSettings = ({ workspace, canDeleteWorkspace }: WorkspaceSettingsP
onUpdateMember={async (memberId, role) => await updateMember(workspace.id, sessionToken, memberId, role)}
onDeleteMember={async (memberId) => await deleteMember(workspace.id, sessionToken, memberId)}
members={workspaceMembers}
className="z-10"
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
/>
</ClientOnly>

Expand Down
14 changes: 8 additions & 6 deletions pages/workspaces/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ const NewWorkspace = () => {
});

return (
<WorkspaceLayout workspaceId="new">
<WorkspaceLayout
workspaceId="new"
footer={
<Button variant="primary" className="flex gap-2.5 items-center cursor-pointer w-min mt-2 sm:mt-0 self-end">
Create Workspace
</Button>
}
>
<div className="grid gap-6 max-w-4xl">
<h1 className="border-b bottom pb-4 text-xl font-medium">Workspace Settings</h1>
<form className="flex flex-col gap-6 mb-2" onSubmit={onCreateWorkspace}>
Expand All @@ -82,11 +89,6 @@ const NewWorkspace = () => {
<h3 className="font-medium mb-2">Workspace Description</h3>
<TextInput name="description" placeholder="Workspace description" className="!py-1.5 w-full text-sm" />
</div>
<div className="bg-white sticky-bottom fixed bottom-0 right-0 self-end m-6">
<Button variant="primary" className="flex gap-2.5 items-center cursor-pointer w-min mt-2 sm:mt-0 self-end">
Create Workspace
</Button>
</div>
</form>

<TrackedReposTable
Expand Down
Loading