Skip to content

Commit

Permalink
feat: enhance Monitor layout with hideSideMenu prop and improve compo…
Browse files Browse the repository at this point in the history
…nent styling
  • Loading branch information
simlarsen committed Jan 23, 2025
1 parent 6bbcc0a commit f8fc1a9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Common/UI/Components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Card: FunctionComponent<ComponentProps> = (

return (
<React.Fragment>
<div className={props.className}>
<div data-testId="card" className={props.className}>
<div className="shadow sm:rounded-md">
<div className="bg-white py-6 px-4 sm:p-6">
<div className="flex justify-between">
Expand Down
5 changes: 3 additions & 2 deletions Common/UI/Components/Forms/BasicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ const BasicForm: ForwardRefExoticComponent<any> = forwardRef(

<div className="flex">
{formSteps && currentFormStepId && (
<div className="w-1/3">
<div style={{ flex: "0 1 auto" }} className="mr-10">
{/* Form Steps */}

<Steps
Expand All @@ -551,8 +551,9 @@ const BasicForm: ForwardRefExoticComponent<any> = forwardRef(
)}
<div
className={`${
formSteps && currentFormStepId ? "w-2/3 pt-6" : "w-full pt-1"
formSteps && currentFormStepId ? "w-auto pt-6" : "w-full pt-1"
}`}
style={{ flex: "1 1 auto" }}
>
{props.error && (
<div className="mb-3">
Expand Down
6 changes: 3 additions & 3 deletions Dashboard/src/Pages/LayoutPageComponentProps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PageComponentProps from './PageComponentProps';
import PageComponentProps from "./PageComponentProps";

export default interface LayoutPageComponentProps extends PageComponentProps {
hideSideMenu?: boolean;
}
hideSideMenu?: boolean;
}
1 change: 1 addition & 0 deletions Dashboard/src/Pages/Monitor/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const MonitorCreate: FunctionComponent<
description={
"Monitor anything - Websites, API, IPv4, IPv6, or send data inbound and more. Create alerts on any metrics and alert the right team."
}
className="mb-10"
>
<ModelForm<Monitor>
modelType={Monitor}
Expand Down
4 changes: 3 additions & 1 deletion Dashboard/src/Pages/Monitor/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const MonitorLayout: FunctionComponent<LayoutPageComponentProps> = (
title={"Monitors"}
breadcrumbLinks={getMonitorBreadcrumbs(path)}
sideMenu={
props.hideSideMenu ? undefined: <DashboardSideMenu project={props.currentProject || undefined} />
props.hideSideMenu ? undefined : (
<DashboardSideMenu project={props.currentProject || undefined} />
)
}
>
<Outlet />
Expand Down
8 changes: 5 additions & 3 deletions Dashboard/src/Routes/MonitorsRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,18 @@ const MonitorCreate: LazyExoticComponent<FunctionComponent<ComponentProps>> =
const MonitorRoutes: FunctionComponent<ComponentProps> = (
props: ComponentProps,
): ReactElement => {

let hideSideMenu: boolean = false;

if(Navigation.isOnThisPage(RouteMap[PageMap.MONITOR_CREATE] as Route)){
if (Navigation.isOnThisPage(RouteMap[PageMap.MONITOR_CREATE] as Route)) {
hideSideMenu = true;
}

return (
<Routes>
<PageRoute path="/" element={<MonitorLayout hideSideMenu={hideSideMenu} {...props} />}>
<PageRoute
path="/"
element={<MonitorLayout hideSideMenu={hideSideMenu} {...props} />}
>
<PageRoute
index
element={
Expand Down

0 comments on commit f8fc1a9

Please sign in to comment.