-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
134 additions
and
65 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,23 @@ | ||
import classNames from "classnames"; | ||
import SearchBar from "./SearchBar"; | ||
import TagList from "./TagList"; | ||
|
||
interface Props { | ||
className?: string; | ||
} | ||
|
||
const TimelineSidebar = (props: Props) => { | ||
return ( | ||
<aside | ||
className={classNames( | ||
"relative w-full h-auto max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start", | ||
props.className, | ||
)} | ||
> | ||
<SearchBar /> | ||
<TagList /> | ||
</aside> | ||
); | ||
}; | ||
|
||
export default TimelineSidebar; |
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,37 @@ | ||
import { Drawer, IconButton } from "@mui/joy"; | ||
import { useEffect, useState } from "react"; | ||
import { useLocation } from "react-router-dom"; | ||
import Icon from "./Icon"; | ||
import TimelineSidebar from "./TimelineSidebar"; | ||
|
||
const TimelineSidebarDrawer = () => { | ||
const location = useLocation(); | ||
const [open, setOpen] = useState(false); | ||
|
||
useEffect(() => { | ||
setOpen(false); | ||
}, [location.pathname]); | ||
|
||
const toggleDrawer = (inOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { | ||
if (event.type === "keydown" && ((event as React.KeyboardEvent).key === "Tab" || (event as React.KeyboardEvent).key === "Shift")) { | ||
return; | ||
} | ||
|
||
setOpen(inOpen); | ||
}; | ||
|
||
return ( | ||
<> | ||
<IconButton onClick={toggleDrawer(true)}> | ||
<Icon.Search className="w-5 h-auto dark:text-gray-400" /> | ||
</IconButton> | ||
<Drawer anchor="right" size="sm" open={open} onClose={toggleDrawer(false)}> | ||
<div className="w-full h-full px-5 bg-zinc-100 dark:bg-zinc-900"> | ||
<TimelineSidebar className="py-4" /> | ||
</div> | ||
</Drawer> | ||
</> | ||
); | ||
}; | ||
|
||
export default TimelineSidebarDrawer; |
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