Skip to content

Commit

Permalink
feat(card): adjust padding and lavender variant
Browse files Browse the repository at this point in the history
- add responsive example to docs
- adjust docs css to support vertical spacing

BREAKING CHANGE:

Card component no longer supports custom className and style props.
Card component layout has changed due to a new padding.
  • Loading branch information
theetrain committed Oct 18, 2017
1 parent 4249997 commit 3882851
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
23 changes: 21 additions & 2 deletions docs/scss/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,31 @@
.docs__layout-horizontally {
.wrapper {
display: flex;
flex-direction: row;
flex-direction: column;

@media (min-width: 768px) {
flex-direction: row;
}
}
}

.docs__horizontal-spacing {
.wrapperExtend > * {
.wrapperExtend > *,
.wrapperExtendHS > * {
margin-right: 1rem;
}
}

.docs__vertical-spacing {
.wrapperExtend > *,
.wrapperExtendVS > * {
margin-bottom: 1rem;
}
}

.docs__max-width400 {
.wrapperExtend > *,
.wrapperExtendMW > * {
max-width: 400px;
}
}
4 changes: 2 additions & 2 deletions src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const Card = ({ variant, children, ...rest }) => (
<Box
{...safeRest(rest)}
spacing="padding"
horizontal={4}
vertical={3}
horizontal={3}
vertical={4}
dangerouslyAddClassName={styles[variant]}
>
{children}
Expand Down
19 changes: 13 additions & 6 deletions src/components/Card/Card.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
```
### Basic usage

```jsx
<Card>
<Heading level="h2">Specifications</Heading>
<div style={{ padding: "1rem 0" }}>
Expand All @@ -12,16 +14,21 @@

### Coloured variants

```jsx {"props": {"className": "docs__layout-horizontally docs__horizontal-spacing"}}
<div className="wrapper">
```jsx {"props": {"className": "docs__layout-horizontally docs__horizontal-spacing docs__max-width400 docs__vertical-spacing"}}
<div className="wrapper wrapperExtendHS wrapperExtendVS wrapperExtendMW">
<Card variant="lavender">
<Heading level="h2">Need a hand?</Heading>
<Paragraph>Our newest, best handset.</Paragraph>
<div style={{ padding: "1rem 0" }}>
<Paragraph>Ready to order? Have a question? We'll get back to you, with volume discounts available to larger accounts.</Paragraph>
</div>
<ButtonLink>Request sales callback</ButtonLink>
</Card>
<Card variant="gray">
<Heading level="h2">Ourtech Phone 2</Heading>
<Paragraph>Our newest, best handset.</Paragraph>
<Heading level="h2">"My office is wherever my customers are. TELUS helps me stay connected whether I'm making a sale or doing payroll."</Heading>
<div style={{ padding: "1rem 0" }}>
<Paragraph>Dave Smith, Foreman</Paragraph>
</div>
</Card>
</div>
```
2 changes: 1 addition & 1 deletion src/components/Card/Card.modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.lavender {
composes: card;

background-color: $color-lavender-blush;
background-color: $color-white-lilac;
}

.gray {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`<Card /> renders 1`] = `
<div
class="verticalPadding-3 horizontalPadding-4 white"
class="verticalPadding-4 horizontalPadding-3 white"
>
Children
</div>
Expand Down

0 comments on commit 3882851

Please sign in to comment.