Skip to content

Commit

Permalink
header improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cdleveille committed Jun 9, 2024
1 parent 2174841 commit 6f81106
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
13 changes: 11 additions & 2 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,23 @@ h1 {

.user-btn {
position: absolute;
top: 0.75rem;
left: 0.75rem;
top: 1.25rem;
left: 1.25rem;
width: 3rem;
height: 3rem;
}

.user-btn-loading-spinner {
position: absolute;
top: 0.25rem;
left: 0.25rem;
z-index: 1000;
}

.settings-btn {
position: absolute;
top: 1.25rem;
right: 1.25rem;
}

.bag-list-dropdown {
Expand Down
8 changes: 3 additions & 5 deletions src/components/misc/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import { Stack } from "@mui/material";

export const Header = () => {
return (
<Stack direction="row" justifyContent="space-between" width="100%">
<div style={{ width: "3rem", height: "3rem" }}>
<UserButton />
</div>
<>
<UserButton />
<Stack direction="row" spacing={-2} alignItems="center" className="title">
<Image src="/img/discit.svg" alt="DiscIt" width={100} height={100} priority />
<h1>DiscIt</h1>
</Stack>
<SettingsButton />
</Stack>
</>
);
};
2 changes: 1 addition & 1 deletion src/components/user/SettingsButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import TuneIcon from "@mui/icons-material/Tune";
export const SettingsButton = () => {
const { showSettingsModal } = useAppContext();
return (
<IconButton aria-label="settings" onClick={showSettingsModal}>
<IconButton className="settings-btn" aria-label="settings" onClick={showSettingsModal}>
<TuneIcon sx={{ fontSize: "2rem" }} />
</IconButton>
);
Expand Down
13 changes: 10 additions & 3 deletions src/components/user/UserButton.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
"use client";

import { useEffect, useState } from "react";

import { SignedIn, SignedOut, UserButton as ClerkUserButton } from "@clerk/nextjs";
import { useAppContext } from "@hooks";
import Icon from "@mui/icons-material/AccountCircle";
import { CircularProgress, IconButton } from "@mui/material";

export const UserButton = () => {
const [isLoading, setIsLoading] = useState(true);
const { showSignInModal } = useAppContext();

useEffect(() => setIsLoading(false), []);

return (
<div className="user-btn">
<SignedOut>
Expand All @@ -16,9 +21,11 @@ export const UserButton = () => {
</IconButton>
</SignedOut>
<SignedIn>
<div className="user-btn-loading-spinner">
<CircularProgress />
</div>
{isLoading && (
<div className="user-btn-loading-spinner">
<CircularProgress />
</div>
)}
<ClerkUserButton
appearance={{
elements: {
Expand Down

0 comments on commit 6f81106

Please sign in to comment.