Skip to content

Commit

Permalink
moved header into a separate component
Browse files Browse the repository at this point in the history
  • Loading branch information
vik378 committed Mar 21, 2024
1 parent 55c2789 commit 0129b0f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/Breadcrumbs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const Breadcrumbs = () => {
const location = useLocation();
const [breadcrumbLabels, setBreadcrumbLabels] = useState({});
const pathnames = location.pathname.split('/').filter(x => x);
const [error, setError] = useState(null);

const fetchModelInfo = async () => {
const response = await fetch(API_BASE_URL + `/model-info`);
Expand Down
17 changes: 10 additions & 7 deletions frontend/src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const Header = () => {
import React from "react";
import {Breadcrumbs} from "./Breadcrumbs";
import {ThemeSwitcher} from "./ThemeSwitcher";

export const Header = () => {
return (
<div className="sticky top-0 z-50 shadow bg-indigo-500 text-indigo-50">
<header>
<p>Stuff goes here</p>
</header>
</div>
<header className=" text-gray-700 p-4 flex justify-between items-center">
<div><Breadcrumbs /></div>
<div></div>
<div><ThemeSwitcher /></div>
</header>
);
};
export default Header;
9 changes: 2 additions & 7 deletions frontend/src/components/TemplateView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import React, {useEffect, useState} from 'react';
import { TemplateDetails } from './TemplateDetails';
import { useLocation, useParams, Navigate } from 'react-router-dom';
import { InstanceView } from './InstanceView';
import { Breadcrumbs } from './Breadcrumbs';
import { ThemeSwitcher } from './ThemeSwitcher';
import { Header } from './Header';

export const TemplateView = ({endpoint}) => {
let { templateName, objectID } = useParams();
Expand All @@ -21,11 +20,7 @@ export const TemplateView = ({endpoint}) => {
return (
<div className="flex flex-col h-screen"> {/* Use h-screen to ensure the container fits the viewport height */}
{/* Header */}
<header className=" text-gray-700 p-4 flex justify-between items-center">
<div><Breadcrumbs /></div>
<div></div>
<div><ThemeSwitcher /></div>
</header>
<Header />

{/* Body: Sidebar + Main Content */}
<div className="flex flex-1 overflow-hidden"> {/* This ensures the remaining height is distributed here */}
Expand Down

0 comments on commit 0129b0f

Please sign in to comment.