Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Commit 2cf6fb5

Browse files
committed
feat(Tooltip): Add arrow to the tooltip
The arrow will now always be shown pointing downwards. Next commit will allow for a placement-based alignment of the arrow.
1 parent 98df96c commit 2cf6fb5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/components/Tooltip/Tooltip.react.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as React from "react";
44
import cn from "classnames";
55
import { Manager, Placement, Reference, Popper } from "react-popper";
66
import type { PopperChildrenProps, ReferenceChildrenProps } from "react-popper";
7+
import styles from "./tooltip.css";
78

89
type Props = {|
910
+content: string,
@@ -41,6 +42,8 @@ class Tooltip extends React.Component<Props, State> {
4142
className
4243
);
4344

45+
const arrowClasses = cn("arrow", styles["tbr-arrow"]);
46+
4447
return (
4548
<Manager>
4649
<Reference>
@@ -64,7 +67,7 @@ class Tooltip extends React.Component<Props, State> {
6467
style={style}
6568
ref={ref}
6669
>
67-
{/* <div className="arrow tbr-arrow" /> */}
70+
<div className={arrowClasses} />
6871
<div className="tooltip-inner">{content}</div>
6972
</div>
7073
);

src/components/Tooltip/tooltip.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* Tooltip-specific Stylesheet */
2+
3+
.tbr-arrow {
4+
left: calc(50% - 0.4rem);
5+
}

0 commit comments

Comments
 (0)