Skip to content

Commit c9b42b1

Browse files
committed
PR feedback
1 parent f01ba24 commit c9b42b1

File tree

4 files changed

+225
-172
lines changed

4 files changed

+225
-172
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@use "@pythnetwork/component-library/theme";
2+
3+
.hoverCard {
4+
@include theme.elevation("default", 2);
5+
6+
display: none;
7+
background-color: theme.color("background", "tooltip");
8+
border-radius: theme.border-radius("md");
9+
color: theme.color("tooltip");
10+
font-size: theme.font-size("xs");
11+
padding: theme.spacing(3);
12+
pointer-events: none;
13+
position: absolute;
14+
width: theme.spacing(60);
15+
overflow: hidden;
16+
z-index: 2; // 2 to render above chart crosshair
17+
}
18+
19+
.hoverCardTable {
20+
color-scheme: dark;
21+
white-space: nowrap;
22+
width: 100%;
23+
24+
td:last-child {
25+
color: theme.color("foreground");
26+
font-weight: theme.font-weight("medium");
27+
text-align: right;
28+
font-variant-numeric: tabular-nums;
29+
}
30+
31+
td:first-child {
32+
color: theme.color("muted");
33+
font-weight: theme.font-weight("normal");
34+
text-align: left;
35+
}
36+
}
37+
38+
:global([data-theme="dark"]) .hoverCardTable {
39+
color-scheme: light;
40+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"use client";
2+
3+
import clsx from "clsx";
4+
import type { ComponentPropsWithRef } from "react";
5+
6+
import styles from "./chart-hover-card.module.scss";
7+
8+
export type ChartHoverCardProps = ComponentPropsWithRef<"div"> & {
9+
timestamp?: string;
10+
price?: string;
11+
confidence?: string;
12+
};
13+
14+
export function ChartHoverCard({
15+
timestamp,
16+
price,
17+
confidence,
18+
className,
19+
...props
20+
}: ChartHoverCardProps) {
21+
return (
22+
<div className={clsx(className, styles.hoverCard)} {...props}>
23+
<table className={styles.hoverCardTable}>
24+
<tbody>
25+
<tr>
26+
<td colSpan={2}>{timestamp}</td>
27+
</tr>
28+
<tr>
29+
<td>Price</td>
30+
<td>{price}</td>
31+
</tr>
32+
{confidence && (
33+
<tr>
34+
<td>Confidence</td>
35+
<td>{confidence}</td>
36+
</tr>
37+
)}
38+
</tbody>
39+
</table>
40+
</div>
41+
);
42+
}

apps/insights/src/components/PriceFeed/Chart/chart.module.scss

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,3 @@
1414
--chart-series-muted-light: #{theme.pallette-color("violet", 100)};
1515
--chart-series-muted-dark: #{theme.pallette-color("violet", 950)};
1616
}
17-
18-
.tooltip {
19-
@include theme.elevation("default", 2);
20-
21-
background-color: theme.color("background", "tooltip");
22-
border-radius: theme.border-radius("md");
23-
color: theme.color("tooltip");
24-
font-size: theme.font-size("xs");
25-
padding: theme.spacing(3);
26-
pointer-events: none;
27-
position: absolute;
28-
z-index: 1000;
29-
width: theme.spacing(60);
30-
overflow: hidden;
31-
}
32-
33-
.tooltipTable {
34-
color-scheme: dark;
35-
white-space: nowrap;
36-
width: 100%;
37-
38-
td:last-child {
39-
color: theme.color("foreground");
40-
font-weight: theme.font-weight("medium");
41-
text-align: right;
42-
font-variant-numeric: tabular-nums;
43-
}
44-
45-
td:first-child {
46-
color: theme.color("muted");
47-
font-weight: theme.font-weight("normal");
48-
text-align: left;
49-
}
50-
}
51-
52-
:global([data-theme="dark"]) .tooltipTable {
53-
color-scheme: light;
54-
}

0 commit comments

Comments
 (0)