Skip to content

Commit

Permalink
added tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
huseyincansoylu committed May 17, 2023
1 parent 158a41e commit ed64e84
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

8 changes: 5 additions & 3 deletions src/components/BarChart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ReactEcharts from "echarts-for-react"
import { InfoIcon } from "../icons"
import Tooltip from "./Tooltip"

const BarChart = () => {
const data = [
Expand Down Expand Up @@ -58,10 +59,11 @@ const BarChart = () => {

return (
<div className="bg-white rounded-md flex flex-col p-4 shadow-md">
<div className="flex justify-between px-10 items-center">
<div className="flex justify-between px-10 items-center z-10">
<h4 className="text-xl font-semibold">Proposal</h4>

<InfoIcon />
<Tooltip text="Information about the metrics here.">
<InfoIcon />
</Tooltip>
</div>

<ReactEcharts option={option} />
Expand Down
18 changes: 18 additions & 0 deletions src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const Tooltip = ({
text,
children,
}: {
text: string
children: React.ReactNode
}) => {
return (
<div className="relative group">
{children}
<div className="hidden group-hover:block absolute bg-gray-500 text-white text-xs px-3 py-2 rounded-md right-1/4">
<div className="min-w-[10rem]">{text}</div>
</div>
</div>
)
}

export default Tooltip
2 changes: 1 addition & 1 deletion src/routes/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Root() {
<img
src={logo}
alt="logo"
className="h-16 w-full cursor-pointer my-4"
className="h-16 w-full cursor-pointer my-3"
/>
</NavLink>

Expand Down

0 comments on commit ed64e84

Please sign in to comment.