Merge branch 'feature/sidebar-hover-message2' into 'main'
Add tooltip messaging on sidebar when closed See merge request vkuchenik/website-framework!29
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { useSlotRecipe, Box, Button, createIcon, CloseButton, IconButton, Stack, useDisclosure, Tooltip } from "@chakra-ui/react";
|
import { useSlotRecipe, Box, Button, createIcon, CloseButton, IconButton } from "@chakra-ui/react";
|
||||||
import { ColorModeButton } from "@/components/ui/color-mode";
|
import { ColorModeButton } from "@/components/ui/color-mode";
|
||||||
|
import { Tooltip } from "@/components/ui/tooltip";
|
||||||
import { FaVolcano } from "react-icons/fa6";
|
import { FaVolcano } from "react-icons/fa6";
|
||||||
import { RxHamburgerMenu } from "react-icons/rx";
|
import { RxHamburgerMenu } from "react-icons/rx";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -96,8 +97,9 @@ export default function Sidebar({ onChangeView }) {
|
|||||||
|
|
||||||
{buttons.map((button, idx) => {
|
{buttons.map((button, idx) => {
|
||||||
const Icon = button.icon;
|
const Icon = button.icon;
|
||||||
return (
|
const buttonElement = (
|
||||||
<Button key={idx}
|
<Button
|
||||||
|
// key={idx}
|
||||||
css={styles.buttons}
|
css={styles.buttons}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setActiveButton(idx);
|
setActiveButton(idx);
|
||||||
@@ -119,9 +121,17 @@ export default function Sidebar({ onChangeView }) {
|
|||||||
{button.name}
|
{button.name}
|
||||||
</span>
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
);
|
||||||
|
// console.log("buttonElement is:", buttonElement)
|
||||||
|
console.log("Returning:", !isOpen ? "Tooltip" : "Button", buttonElement);
|
||||||
|
return !isOpen ? (
|
||||||
|
<Tooltip key={ idx } content={ button.name } placement="right" hasArrow>
|
||||||
|
{ buttonElement }
|
||||||
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
buttonElement
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
<ColorModeButton position="absolute" bottom="2"/>
|
<ColorModeButton position="absolute" bottom="2"/>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user