Skip to content

Commit

Permalink
#11 Avoid duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
tina-e committed Aug 15, 2022
1 parent f26205b commit 67c72f2
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
56 changes: 56 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@types/react-draft-wysiwyg": "^1.13.4",
"classnames": "^2.3.1",
"cx": "^22.8.1",
"gh-pages": "^4.0.0",
"phosphor-react": "^1.4.1",
"react": "^18.2.0",
Expand Down
6 changes: 5 additions & 1 deletion src/components/SidebarHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Bookmarks, List, Notepad, Scales } from "phosphor-react"
import { useState } from "react"
import { Button } from "./Button"
import cx from "classnames"

export const SidebarHeader = () => {
const [isNotesActive, setIsNotesActive] = useState<boolean>(false);
Expand All @@ -9,7 +10,10 @@ export const SidebarHeader = () => {
const [sidebarOpen, setSidebarOpen] = useState<boolean>(true);

return (
<div className={sidebarOpen ? "flex flex-row justify-between" : "flex flex-row justify-end"}>
<div className={cx("flex flex-row", {
"justify-between": sidebarOpen,
"justify-end": !sidebarOpen,
})}>
<div className={sidebarOpen ? "transition duration-300 rotate-90" : "transition duration-300 rotate-0"}
onClick={() => setSidebarOpen(!sidebarOpen)}>
<Button bgColor="None"
Expand Down

0 comments on commit 67c72f2

Please sign in to comment.