top bar styling fixes/cleanup, centered

This commit is contained in:
BFlat committed 2024-03-24 17:33:10 +07:00
1 parent c50c843444
commit 94db2df0cf
4 files changed
+47 -64

No files matched your search

-31
View File
@@ -1,31 +0,0 @@
import React, { createContext, useContext, useState } from "react";
interface ButtonSelectContextType {
selectedButton: number | null;
setSelectedButton: (index: number | null) => void;
}
const ButtonSelectContext = createContext<ButtonSelectContextType | undefined>(
undefined,
);
export const ButtonSelectProvider: React.FC = ({ children }) => {
const [selectedButton, setSelectedButton] = useState<number | null>(null);
return (
<ButtonSelectContext.Provider value={{ selectedButton, setSelectedButton }}>
{children}
</ButtonSelectContext.Provider>
);
};
// Custom hook to use the context
export const useButtonSelect = () => {
const context = useContext(ButtonSelectContext);
if (context === undefined) {
throw new Error(
"useButtonSelect must be used within a ButtonSelectProvider",
);
}
return context;
};
+44 -24
View File
@@ -1,32 +1,52 @@
import { useContext } from 'react';
import { useContext } from "react";
import { Button } from '~/components/Button'
import { faRightToBracket } from '@fortawesome/pro-solid-svg-icons'
import { TopBarInnerContext } from '~/contexts/TopBarInner';
import { Button } from "~/components/Button";
import {
faChevronLeft,
faRightToBracket,
} from "@fortawesome/pro-solid-svg-icons";
import { TopBarInnerContext } from "~/contexts/TopBarInner";
import { ButtonLink } from "~/components";
export const TopBar = () => {
return (
<header className="
fixed top-0 left-0 w-full
bg-ui-panel border-b border-ui-panel-border
">
<nav className="mx-auto flex max-w-full items-center justify-between p-4" aria-label="Global">
<div className="flex lg:flex-1">
<a href="#" className="-m-1.5 p-1.5">
<span className="sr-only">FakeYou</span>
<img className="h-10 w-auto ml-0.5" src="/resources/images/Storyteller-Logo-1.png" alt="Logo FakeYou StoryTeller.ai" />
</a>
<span className="w-4 lg:w-8"/>
<TopBarInner />
<header
className="fixed left-0 top-0 w-full
border-b border-ui-panel-border bg-ui-panel"
>
<nav
className="mx-auto flex max-w-full items-center justify-between px-4 py-3"
aria-label="Global"
>
<div className="grid w-full grid-cols-3 gap-2">
<div className="flex gap-4">
<a href="/" className="">
<span className="sr-only">Storyteller.ai</span>
<img
className="h-9 w-auto"
src="/resources/images/Storyteller-Logo-1.png"
alt="Logo FakeYou StoryTeller.ai"
/>
</a>
<ButtonLink to={"/"} variant="secondary" icon={faChevronLeft}>
Back to Dashboard
</ButtonLink>
</div>
<div className="flex justify-center">
<TopBarInner />
</div>
<div className="flex justify-end">
<Button icon={faRightToBracket}>Login</Button>
</div>
</div>
<Button icon={faRightToBracket}>Login</Button>
</nav>
</header>
)
}
);
};
const TopBarInner = ()=>{
const { TopBarInner } = useContext(TopBarInnerContext) || {}
return(TopBarInner);
}
const TopBarInner = () => {
const { TopBarInner } = useContext(TopBarInnerContext) || {};
return TopBarInner;
};
+2 -8
View File
@@ -72,16 +72,10 @@ export const PageEnigma = () => {
return (
<div>
<TopBarHelmet>
<div className="flex grow justify-between">
<ButtonLink to={"/"} variant="secondary" icon={faChevronLeft}>
Back to Dashboard
</ButtonLink>
<Button icon={faWandSparkles}>Generate Movie</Button>
<span className="w-8" />
</div>
<Button icon={faWandSparkles}>Generate Movie</Button>
</TopBarHelmet>
<div style={{ height: "calc(100vh - 73px)" }}>
<div style={{ height: "calc(100vh - 64px)" }}>
{/* Engine section/side panel */}
<div
className="flex"
+1 -1
View File
@@ -3,6 +3,6 @@ body {
}
.topbar-spacer {
height: 73px;
height: 64px;
width: 100vw;
}