2020-06-19 11:36:49 +01:00
|
|
|
import "./Tooltip.scss";
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
type TooltipProps = {
|
|
|
|
children: React.ReactNode;
|
|
|
|
label: string;
|
2020-12-14 18:54:54 +05:30
|
|
|
position?: "above" | "below";
|
|
|
|
long?: boolean;
|
2020-06-19 11:36:49 +01:00
|
|
|
};
|
|
|
|
|
2020-12-14 18:54:54 +05:30
|
|
|
export const Tooltip = ({
|
|
|
|
children,
|
|
|
|
label,
|
|
|
|
position = "below",
|
|
|
|
long = false,
|
|
|
|
}: TooltipProps) => (
|
2020-06-19 11:36:49 +01:00
|
|
|
<div className="Tooltip">
|
2020-12-14 18:54:54 +05:30
|
|
|
<span
|
|
|
|
className={
|
|
|
|
position === "above"
|
|
|
|
? "Tooltip__label Tooltip__label--above"
|
|
|
|
: "Tooltip__label Tooltip__label--below"
|
|
|
|
}
|
|
|
|
style={{ width: long ? "50ch" : "10ch" }}
|
|
|
|
>
|
|
|
|
{label}
|
|
|
|
</span>
|
2020-06-19 11:36:49 +01:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
);
|