-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from Jaewoook/feature/system-menubar
Add system menubar
- Loading branch information
Showing
7 changed files
with
85 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { useClock } from "./useClock"; | ||
export { useDrag } from "./useDrag"; | ||
export { useCoordinateValues } from "./useCoordinateValues"; | ||
export { useOutsideClick } from "./useOutsideClick"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
export const useClock = () => { | ||
const [time, setTime] = useState<Date>(new Date()); | ||
|
||
useEffect(() => { | ||
const intervalId = setInterval(() => { | ||
setTime(new Date()); | ||
}, 1000); | ||
|
||
return () => { | ||
clearInterval(intervalId); | ||
} | ||
}, []); | ||
|
||
|
||
return time; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72b0c98
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
portfolio-web – ./
portfolio-web-jaewoook.vercel.app
portfolio-web-ten.vercel.app
portfolio.jaewook.me
portfolio-web-git-master-jaewoook.vercel.app