Skip to content

Commit f3fdc88

Browse files
committed
fix: rm absolute positioning, use flex layout
fixes RTL layout bugs
1 parent 18b0643 commit f3fdc88

File tree

1 file changed

+20
-34
lines changed

1 file changed

+20
-34
lines changed

src/components/StatsBoxGrid/GridItem.tsx

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ export const GridItem = ({ metric }: GridItemProps) => {
121121
height={80}
122122
flexDirection="column"
123123
justifyContent="space-between"
124-
alignItems="flex-start"
125124
borderX={{
126125
base: "0px solid #000000",
127126
lg: "1px solid",
@@ -146,41 +145,28 @@ export const GridItem = ({ metric }: GridItemProps) => {
146145
<OldText>{description}</OldText>
147146
</Box>
148147
{hasData && (
149-
<>
150-
<Box
151-
position="absolute"
152-
insetInlineStart={0}
153-
bottom={0}
154-
width="100%"
155-
height="65%"
156-
>
157-
{chart}
158-
</Box>
159-
<Box
160-
position="absolute"
161-
bottom="20px"
162-
fontFamily="monospace"
163-
insetInlineEnd="20px"
164-
>
148+
<Box position="absolute" insetInline="0" bottom={0} height="65%">
149+
{chart}
150+
</Box>
151+
)}
152+
<Flex justifyContent="space-between">
153+
<Box
154+
fontSize={{ base: "max(8.8vw, 48px)", lg: "min(4.4vw, 4rem)" }}
155+
fontWeight={600}
156+
color="text"
157+
flexWrap="wrap"
158+
textOverflow="ellipsis"
159+
lineHeight="1.6rem"
160+
mb="2"
161+
>
162+
{value}
163+
</Box>
164+
{hasData && (
165+
<Box fontFamily="monospace" me="-1" mb="-1">
165166
{buttonContainer}
166167
</Box>
167-
</>
168-
)}
169-
<Box
170-
position="absolute"
171-
bottom="8%"
172-
fontSize={{ base: "max(8.8vw, 48px)", lg: "min(4.4vw, 4rem)" }}
173-
fontWeight={600}
174-
marginTop={0}
175-
marginBottom={4}
176-
color="text"
177-
flexWrap="wrap"
178-
textOverflow="ellipsis"
179-
lineHeight="1.6rem"
180-
insetInlineStart="5"
181-
>
182-
{value}
183-
</Box>
168+
)}
169+
</Flex>
184170
</Flex>
185171
)
186172
}

0 commit comments

Comments
 (0)