-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code Organization, New Features, Bug Fixing (#14)
* Add link and layout * Update Hotbar.tsx
- Loading branch information
1 parent
528ceae
commit fcb4274
Showing
8 changed files
with
343 additions
and
109 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,48 @@ | ||
import { FC, useContext } from "react"; | ||
import { RectangleGroupIcon, ShareIcon } from "@heroicons/react/24/solid"; | ||
|
||
import { GraphContext } from "../Graph"; | ||
|
||
interface HotbarButton { | ||
onClick?: () => void; | ||
Icon: any; | ||
name: string; | ||
} | ||
|
||
const Hotbar: FC = () => { | ||
const { doLayout, copyLink } = useContext(GraphContext); | ||
|
||
const Buttons: HotbarButton[] = [ | ||
{ | ||
Icon: RectangleGroupIcon, | ||
name: "Organize Layout", | ||
onClick: doLayout, | ||
}, | ||
{ | ||
Icon: ShareIcon, | ||
name: "Copy Link", | ||
onClick: copyLink, | ||
}, | ||
]; | ||
|
||
return ( | ||
<div className="mb-16 flex h-fit w-fit flex-col gap-y-1 rounded-lg bg-gray-800 p-2"> | ||
{Buttons.map((button) => { | ||
return ( | ||
<button | ||
className="group flex flex-row items-center" | ||
key={button.name} | ||
onClick={button.onClick} | ||
> | ||
<button.Icon className="h-10 w-10 rounded-lg p-1 text-blue-100 transition-all duration-200 hover:bg-gray-700 hover:text-blue-300" /> | ||
<h1 className="absolute ml-[3.25rem] mt-0.5 w-max rounded-lg bg-gray-800 px-3 py-2 text-sm font-medium text-blue-300 opacity-0 shadow-sm transition-opacity duration-300 group-hover:opacity-100 dark:bg-gray-700"> | ||
{button.name} | ||
</h1> | ||
</button> | ||
); | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Hotbar; |
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,3 @@ | ||
import Hotbar from "./Hotbar"; | ||
|
||
export default Hotbar; |
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
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