Skip to content

Commit 3ff90d9

Browse files
chore(overview, priceFeeds): add Stats component for quick insights display on Overview and Price Feeds pages
1 parent 6f0ce7e commit 3ff90d9

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import styles from "./index.module.scss";
2+
import { Stats } from "../Stats";
23

34
export const Overview = () => (
45
<div className={styles.overview}>
56
<h1 className={styles.header}>Overview</h1>
7+
<Stats />
68
</div>
79
);

apps/insights/src/components/PriceFeeds/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { YesterdaysPricesProvider, ChangePercent } from "../ChangePercent";
2323
import { LivePrice } from "../LivePrices";
2424
import { PriceFeedIcon } from "../PriceFeedIcon";
2525
import { PriceFeedTag } from "../PriceFeedTag";
26+
import { Stats } from "../Stats";
2627

2728
const PRICE_FEEDS_ANCHOR = "priceFeeds";
2829

@@ -48,6 +49,7 @@ export const PriceFeeds = async () => {
4849
<div className={styles.priceFeeds}>
4950
<h1 className={styles.header}>Price Feeds</h1>
5051
<div className={styles.body}>
52+
<Stats />
5153
<section className={styles.stats}>
5254
<StatCard
5355
variant="primary"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@use "@pythnetwork/component-library/theme";
2+
3+
.statWrapper {
4+
position: relative;
5+
width: 100%;
6+
display: flex;
7+
8+
@include theme.mobile {
9+
width: 100dvw; // Extend the width beyond the root padding
10+
margin-left: -#{theme.spacing(4)};
11+
margin-right: -#{theme.spacing(4)};
12+
white-space: nowrap;
13+
overflow-x: auto;
14+
overflow-y: hidden;
15+
-webkit-overflow-scrolling: touch;
16+
scroll-snap-type: x mandatory;
17+
scroll-padding: theme.spacing(4);
18+
left: 0;
19+
right: 0;
20+
21+
// Optional: Hide scrollbars
22+
scrollbar-width: none;
23+
&::-webkit-scrollbar {
24+
display: none;
25+
}
26+
}
27+
}
28+
29+
.statsContainer {
30+
gap: theme.spacing(6);
31+
width: 100%;
32+
display: flex;
33+
flex-direction: row;
34+
flex-wrap: nowrap;
35+
justify-content: space-between;
36+
align-items: center;
37+
38+
> * {
39+
display: flex;
40+
width: 100%;
41+
flex-grow: 1;
42+
flex-shrink: 0;
43+
flex-basis: 0;
44+
min-width: 0;
45+
max-width: 100%;
46+
min-height: 0;
47+
}
48+
49+
@include theme.mobile {
50+
width: max-content;
51+
gap: theme.spacing(3);
52+
padding: 0 theme.spacing(4);
53+
> * {
54+
width: 280px;
55+
scroll-snap-align: start;
56+
}
57+
}
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { ArrowLineDown } from "@phosphor-icons/react/dist/ssr/ArrowLineDown"
2+
import { StatCard } from "@pythnetwork/component-library/StatCard"
3+
4+
import styles from "./index.module.scss"
5+
6+
export const Stats = () => {
7+
return (
8+
<div className={styles.statWrapper}>
9+
<div className={styles.statsContainer}>
10+
<StatCard
11+
variant="primary"
12+
header="Active Feeds"
13+
stat={7}
14+
href={'/price-feeds'}
15+
corner={<ArrowLineDown />}
16+
/>
17+
<StatCard
18+
header="Active Feeds"
19+
stat={7}
20+
href={'/price-feeds'}
21+
corner={<ArrowLineDown />}
22+
/>
23+
<StatCard
24+
header="Active Feeds"
25+
stat={7}
26+
href={'/price-feeds'}
27+
corner={<ArrowLineDown />}
28+
/>
29+
<StatCard
30+
header="Active Feeds"
31+
stat={7}
32+
href={'/price-feeds'}
33+
corner={<ArrowLineDown />}
34+
/>
35+
</div>
36+
</div>
37+
)
38+
}

0 commit comments

Comments
 (0)