|
1 | 1 | import { useEffect, useState } from "react" |
2 | 2 | import { Formatter } from "~/utils/misc/formatter" |
| 3 | +import './epochProgress.scss' |
3 | 4 |
|
4 | 5 | type MetadataItem = { label: string; value: string | number } |
5 | 6 |
|
@@ -31,87 +32,31 @@ const EpochProgress = ({ period, color = "white" }: Props) => { |
31 | 32 | const remaining = Math.max(endMs - now, 0) |
32 | 33 |
|
33 | 34 | return ( |
34 | | - <div style={styles.wrapper}> |
| 35 | + <div className="epoch-progress"> |
35 | 36 | {metadata.length > 0 && ( |
36 | | - <div style={styles.metaRow}> |
| 37 | + <div className="epoch-progress-meta"> |
37 | 38 | {metadata.map((m) => ( |
38 | | - <span key={m.label} style={styles.pill}> |
39 | | - <span style={styles.pillLabel}>{m.label}</span> |
40 | | - <span style={styles.pillValue}>{m.value}</span> |
| 39 | + <span key={m.label} className="epoch-progress-pill"> |
| 40 | + <span className="epoch-progress-pill-label">{m.label}</span> |
| 41 | + <span className="epoch-progress-pill-value">{m.value}</span> |
41 | 42 | </span> |
42 | 43 | ))} |
43 | 44 | </div> |
44 | 45 | )} |
45 | 46 |
|
46 | | - <div style={styles.barOuter}> |
| 47 | + <div className="epoch-progress-bar"> |
47 | 48 | <div |
48 | | - style={{ |
49 | | - ...styles.barFill, |
50 | | - width: `${progress}%`, |
51 | | - background: color, |
52 | | - }} |
| 49 | + className="epoch-progress-fill" |
| 50 | + style={{ width: `${progress}%`, background: color }} |
53 | 51 | /> |
54 | 52 | </div> |
55 | 53 |
|
56 | | - <div style={styles.footer}> |
57 | | - <span style={styles.footerText}>{progress.toFixed(1)}%</span> |
58 | | - <span style={styles.footerText}>{Formatter.duration(remaining)} remaining</span> |
| 54 | + <div className="epoch-progress-footer"> |
| 55 | + <span>{progress.toFixed(1)}%</span> |
| 56 | + <span>{Formatter.duration(remaining)} remaining</span> |
59 | 57 | </div> |
60 | 58 | </div> |
61 | 59 | ) |
62 | 60 | } |
63 | 61 |
|
64 | | -const styles: Record<string, React.CSSProperties> = { |
65 | | - wrapper: { |
66 | | - width: "100%", |
67 | | - }, |
68 | | - metaRow: { |
69 | | - display: "flex", |
70 | | - flexWrap: "wrap", |
71 | | - gap: 8, |
72 | | - marginBottom: 10.5, |
73 | | - }, |
74 | | - pill: { |
75 | | - display: "inline-flex", |
76 | | - alignItems: "center", |
77 | | - gap: 6, |
78 | | - background: "rgba(255,255,255,0.06)", |
79 | | - borderRadius: 6, |
80 | | - padding: "4px 10px", |
81 | | - fontSize: 13, |
82 | | - }, |
83 | | - pillLabel: { |
84 | | - color: "rgba(255,255,255,0.45)", |
85 | | - textTransform: "uppercase" as const, |
86 | | - letterSpacing: "0.04em", |
87 | | - fontWeight: 500, |
88 | | - }, |
89 | | - pillValue: { |
90 | | - color: "rgba(255,255,255,0.9)", |
91 | | - fontVariantNumeric: "tabular-nums", |
92 | | - fontWeight: 600, |
93 | | - }, |
94 | | - barOuter: { |
95 | | - width: "100%", |
96 | | - height: 6, |
97 | | - borderRadius: 3, |
98 | | - background: "rgba(255,255,255,0.08)", |
99 | | - overflow: "hidden", |
100 | | - }, |
101 | | - barFill: { |
102 | | - height: "100%", |
103 | | - borderRadius: 3, |
104 | | - transition: "width 1s linear", |
105 | | - }, |
106 | | - footer: { |
107 | | - display: "flex", |
108 | | - justifyContent: "space-between", |
109 | | - marginTop: 6, |
110 | | - fontSize: 12, |
111 | | - color: "rgba(255,255,255,0.5)", |
112 | | - fontVariantNumeric: "tabular-nums", |
113 | | - }, |
114 | | - footerText: {}, |
115 | | -} |
116 | | - |
117 | 62 | export default EpochProgress |
0 commit comments