Skip to content

Commit

Permalink
feat(menubar): add base MenuBar component
Browse files Browse the repository at this point in the history
- show default clock
  • Loading branch information
Jaewoook committed Jan 21, 2024
1 parent b90a176 commit 2b75462
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
30 changes: 30 additions & 0 deletions app/components/MenuBar/MenuBar.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { style } from "@vanilla-extract/css";

export const container = style({
height: 32,
backgroundColor: "rgba(33, 33, 33, 0.4)",
position: "absolute",
top: 0,
left: 0,
right: 0,
zIndex: 1,
paddingLeft: 16,
paddingRight: 16,
display: "flex",
});

export const menuWrapper = style({
display: "inline-flex",
alignItems: "center",
flex: 1,
});

export const rightMenuWrapper = style([menuWrapper, {
flexDirection: "row-reverse",
marginLeft: "auto",
}]);

export const clock = style({
color: "#fff",
fontSize: 14,
});
21 changes: 21 additions & 0 deletions app/components/MenuBar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use client";
import { format } from "date-fns";
import { useMemo } from "react";

import { useClock } from "../../hooks";
import * as css from "./MenuBar.css";

export const MenuBar = () => {
const time = useClock();
const clock = useMemo(() => format(time, "E MMM d") + "\u00A0\u00A0" + format(time, "h:mm a"), [time]);

return (
<nav className={css.container}>
<div className={css.menuWrapper}>
</div>
<div className={css.rightMenuWrapper}>
<p className={css.clock}>{clock}</p>
</div>
</nav>
);
};
14 changes: 10 additions & 4 deletions app/home/components/Shortcuts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const ProfileShortcut = () => {
<Shortcut
icon={<Image width={72} height={72} src="/images/icons/icon-profile.png" alt="profile icon" />}
label="Profile"
initialX="24px"
initialY="40px"
onClick={handleClick}
/>
);
Expand All @@ -30,7 +32,8 @@ export const ResumeShortcut = () => {
<Shortcut
icon={<Image width={72} height={72} src="/images/icons/icon-resume.png" alt="resume icon" />}
label="Resume"
initialY="120px"
initialX="24px"
initialY="160px"
onClick={handleClick}
/>
);
Expand All @@ -46,7 +49,8 @@ export const SettingsShortcut = () => {
<Shortcut
icon={<Image width={72} height={72} src="/images/icons/icon-settings.png" alt="settings icon" />}
label="Settings"
initialY="240px"
initialX="24px"
initialY="280px"
onClick={handleClick}
/>
);
Expand All @@ -61,7 +65,8 @@ export const GitHubShortcut = () => {
<Shortcut
icon={<Image width={72} height={72} src="/images/icons/icon-github.png" alt="github icon" />}
label="GitHub"
initialY="360px"
initialX="24px"
initialY="400px"
onClick={handleClick}
/>
);
Expand All @@ -77,7 +82,8 @@ export const BlogShortcut = () => {
<Shortcut
icon={<Image width={72} height={72} src="/images/icons/icon-blog.png" alt="blog icon" />}
label="Blog"
initialY="480px"
initialX="24px"
initialY="520px"
onClick={handleClick}
/>
);
Expand Down
2 changes: 2 additions & 0 deletions app/home/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LayerManager } from "../components/Layer";
import { MenuBar } from "../components/MenuBar";
import { Profile } from "./components/Profile";
import { Resume } from "./components/Resume";
import { Settings } from "./components/Settings";
Expand Down Expand Up @@ -70,6 +71,7 @@ import * as Shortcut from "./components/Shortcuts";
const Main = () => {
return (
<LayerManager>
<MenuBar />
<Shortcut.ResumeShortcut />
<Shortcut.GitHubShortcut />
<Shortcut.SettingsShortcut />
Expand Down

0 comments on commit 2b75462

Please sign in to comment.