Skip to content

Commit

Permalink
fix(BoemlyList): Icon alignment
Browse files Browse the repository at this point in the history
Align icon with the first line of the text
  • Loading branch information
raulsteurer committed Nov 30, 2023
1 parent 079d402 commit fd10253
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions src/components/BoemlyList/BoemlyList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Box,
Center,
Flex,
List,
ListIcon,
ListItem,
Expand Down Expand Up @@ -37,28 +38,36 @@ export const BoemlyList: React.FC<BoemlyListProps> = ({
return (
<List spacing="4" as={ordered ? 'ol' : 'ul'} {...props}>
{listItems.map(({ id, text }, index) => (
<ListItem key={id} display="flex" alignItems="center">
<ListIcon
as={() => (
<Center
__css={styles.icon}
width="6"
height="6"
minWidth="6"
borderRadius="lg"
float="left"
mr="4"
>
{ordered ? (
<Text size="xsLowBold" color="black">
{index + 1}
</Text>
) : (
icon
)}
</Center>
)}
/>
<ListItem key={id} display="flex" alignItems="baseline">
<Flex alignItems="center" position="relative">
{/* Insert a zero-width character so that `align-items: baseline`
aligns the icon to the first line of the text */}
<Text size={textSize} as="span">
&zwnj;
</Text>

<ListIcon
as={() => (
<Center
__css={styles.icon}
width="6"
height="6"
minWidth="6"
borderRadius="lg"
float="left"
mr="4"
>
{ordered ? (
<Text size="xsLowBold" color="black">
{index + 1}
</Text>
) : (
icon
)}
</Center>
)}
/>
</Flex>

<Text size={textSize} color={textColor}>
{text}
Expand Down

1 comment on commit fd10253

@vercel
Copy link

@vercel vercel bot commented on fd10253 Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.