Skip to content

Commit

Permalink
fix(core-price-lockup): add padding to fix misalignment
Browse files Browse the repository at this point in the history
add padding bottom to strikethrough price lockups to accommodate difference in font size
  • Loading branch information
elissa-matsushita authored and jraff committed Nov 4, 2020
1 parent f48a96c commit e535250
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 5 deletions.
10 changes: 10 additions & 0 deletions packages/PriceLockup/PriceLockup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ const hasStrikethrough = strikethroughValue => {
return undefined
}

const addStrikethroughPadding = strikethroughValue => {
if (strikethroughValue) {
return {
paddingBottom: '3px',
}
}
return undefined
}

const StyledRateText = styled.span(({ size }) => {
if (size === 'large') {
return large
Expand Down Expand Up @@ -128,6 +137,7 @@ const StyledRateTextWrapper = styled.div(({ strikethrough }) => {
return {
display: 'flex',
color: strikethrough ? colorGreyRaven : undefined,
...addStrikethroughPadding(strikethrough),
}
})

Expand Down
50 changes: 45 additions & 5 deletions packages/PriceLockup/PriceLockup.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,59 @@

```jsx
<FlexGrid>
<FlexGrid.Row verticalAlign="bottom">
<FlexGrid.Col xs={2}>
<FlexGrid.Row>
<FlexGrid.Col xs={12} md={5}>
<Card variant="defaultWithBorder">
<Box between={3}>
<Heading level="h3">Internet 15 - Special Offer</Heading>
<FlexGrid>
<FlexGrid.Row verticalAlign="bottom" horizontalAlign="start">
<FlexGrid.Col xs={5}>
<PriceLockup
topText="Starting at"
size="medium"
price="25"
signDirection="left"
rateText="/mo."
/>
</FlexGrid.Col>
<FlexGrid.Col xs={5}>
<PriceLockup
size="small"
strikethrough
ariaLabel="price without discount"
price="50"
signDirection="left"
rateText="/mo."
/>
</FlexGrid.Col>
</FlexGrid.Row>
</FlexGrid>
<Text size="medium">Good for basic browsing, and posting to social media.</Text>
<Button>Add to cart</Button>
<ChevronLink href="#">Learn more</ChevronLink>
</Box>
</Card>
</FlexGrid.Col>
</FlexGrid.Row>
</FlexGrid>
```

```jsx
<FlexGrid>
<FlexGrid.Row verticalAlign="bottom" horizontalAlign="start">
<FlexGrid.Col xs={3}>
<PriceLockup
topText="Starting at"
size="medium"
size="large"
price="25"
signDirection="left"
rateText="/mo."
/>
</FlexGrid.Col>
<FlexGrid.Col xs={1}>
<FlexGrid.Col xs={2}>
<PriceLockup
size="small"
size="medium"
strikethrough
ariaLabel="price without discount"
price="50"
Expand Down

0 comments on commit e535250

Please sign in to comment.