Skip to content

Commit c1ee50c

Browse files
fix: replace flex with grid
1 parent 7914600 commit c1ee50c

File tree

5 files changed

+29
-84
lines changed

5 files changed

+29
-84
lines changed

src/colors.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,15 @@ export const circularProgressPathColor = slotStatusBlue;
164164

165165
// slot details
166166
export const slotDetailsMySlotsColor = "#0080e6";
167-
export const slotDetailsQuickSearchTextColor = "#7B7B7B";
168-
export const slotDetailsEarliestSlotColor = "#12A594";
169-
export const slotDetailsRecentSlotColor = "#00A2C7";
170-
export const slotDetailsSkippedSlotColor = "#B54548";
171-
export const slotDetailsFeesSlotColor = "#197CAE";
172-
export const slotDetailsTipsSlotColor = "#30A46C";
173-
export const slotDetailsRewardsSlotColor = "#5472E4";
174-
export const slotDetailsClickableSlotColor = "#0090FF";
167+
export const slotDetailsSearchLabelColor = "#FFF";
168+
export const slotDetailsQuickSearchTextColor = "var(--gray-10)";
169+
export const slotDetailsEarliestSlotColor = "var(--teal-9)";
170+
export const slotDetailsRecentSlotColor = "var(--cyan-9)";
171+
export const slotDetailsSkippedSlotColor = "var(--red-8)";
172+
export const slotDetailsFeesSlotColor = "var(--sky-8)";
173+
export const slotDetailsTipsSlotColor = "var(--green-9)";
174+
export const slotDetailsRewardsSlotColor = "var(--indigo-10)";
175+
export const slotDetailsClickableSlotColor = "var(--blue-9)";
175176
export const slotDetailsBackgroundColor = "#15181e";
176177
export const slotDetailsColor = "#9aabc3";
177178
export const slotDetailsSkippedBackgroundColor = "#250f0f";

src/consts.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,9 @@ export const maxZIndex = 110;
8080

8181
export const numQuickSearchSlots = 3;
8282
export const quickSearchCardWidth = 226;
83-
export const quickSearchSpacing = 40;
83+
export const slotSearchGap = 40;
8484
export const slotSearchPadding = 20;
85+
export const slotSearchMaxWidth =
86+
2 * slotSearchPadding +
87+
numQuickSearchSlots * quickSearchCardWidth +
88+
(numQuickSearchSlots - 1) * slotSearchGap;

src/features/SlotDetails/SlotSearch.tsx

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import {
1212
baseSelectedSlotAtom,
1313
SelectedSlotValidityState,
1414
} from "../Overview/SlotPerformance/atoms";
15-
import { useQuickSearchWidth } from "../../hooks/useQuickSearchWidth";
1615
import { Label } from "radix-ui";
17-
import { Flex, IconButton, TextField, Text } from "@radix-ui/themes";
16+
import { Flex, IconButton, TextField, Text, Grid } from "@radix-ui/themes";
1817
import {
1918
numQuickSearchSlots,
2019
quickSearchCardWidth,
21-
quickSearchSpacing,
20+
slotSearchGap,
21+
slotSearchMaxWidth,
2222
slotSearchPadding,
2323
} from "../../consts";
2424
import styles from "./slotSearch.module.css";
@@ -50,7 +50,6 @@ export function SlotSearch() {
5050
const [searchSlot, setSearchSlot] = useState<string>("");
5151
const epoch = useAtomValue(epochAtom);
5252
const { isValid } = useAtomValue(baseSelectedSlotAtom);
53-
const quickSearchWidth = useQuickSearchWidth();
5453

5554
const submitSearch = useCallback(() => {
5655
if (searchSlot === "") setSelectedSlot(undefined);
@@ -63,14 +62,14 @@ export function SlotSearch() {
6362
}, [selectedSlot]);
6463

6564
return (
66-
<Flex
67-
direction="column"
68-
width={`${quickSearchWidth}px`}
69-
height="100%"
65+
<Grid
66+
width="100%"
67+
maxWidth={`${slotSearchMaxWidth}px`}
7068
justify="center"
71-
align="center"
72-
gap="40px"
69+
m="auto"
70+
gap={`${slotSearchGap}px`}
7371
p={`${slotSearchPadding}px`}
72+
columns={`repeat(auto-fit, ${quickSearchCardWidth}px)`}
7473
>
7574
<form
7675
onSubmit={(e) => {
@@ -92,6 +91,7 @@ export function SlotSearch() {
9291
onChange={(e) => setSearchSlot(e.target.value)}
9392
size="3"
9493
color={isValid ? "teal" : "red"}
94+
autoFocus
9595
>
9696
<TextField.Slot side="right">
9797
<IconButton variant="ghost" color="gray" onClick={submitSearch}>
@@ -102,7 +102,7 @@ export function SlotSearch() {
102102
{!isValid && <Errors />}
103103
</form>
104104
<QuickSearch />
105-
</Flex>
105+
</Grid>
106106
);
107107
}
108108

@@ -121,12 +121,7 @@ function QuickSearch() {
121121
}, [processedLeaderSlots]);
122122

123123
return (
124-
<Flex
125-
gap={`${quickSearchSpacing}px`}
126-
justify="center"
127-
align="center"
128-
wrap="wrap"
129-
>
124+
<>
130125
<QuickSearchCard
131126
icon={<CounterClockwiseClockIcon />}
132127
label="Earliest Slots"
@@ -172,7 +167,7 @@ function QuickSearch() {
172167
metricsFmt={getSolStringWithFourDecimals}
173168
unit="SOL"
174169
/>
175-
</Flex>
170+
</>
176171
);
177172
}
178173

src/features/SlotDetails/slotSearch.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
display: flex;
33
flex-direction: column;
44
width: 100%;
5-
align-items: flex-start;
65
gap: 8px;
6+
grid-column: 1 / -1;
77
}
88

99
.search-label {
1010
font-size: 16px;
1111
font-weight: 510;
12+
color: var(--slot-details-search-label-color);
1213
}
1314

1415
.search-field {

src/hooks/useQuickSearchWidth.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)