Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 17fe6b3

Browse files
authored
Merge pull request #15 from stellar/update/card
update/card > updated card's design based on new design
2 parents a1f143a + 98d19f2 commit 17fe6b3

File tree

3 files changed

+74
-16
lines changed

3 files changed

+74
-16
lines changed

src/components/Card.js

+20-8
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,39 @@ import * as React from "react";
22
import styled from "styled-components";
33
import PropTypes from "prop-types";
44

5-
import { PALETTE } from "../shared";
5+
import { PALETTE, MEDIA_QUERIES } from "../shared";
66

77
import Text from "./Text";
88
import SubsectionHeader from "./SubsectionHeader";
99

1010
const CardEl = styled.div`
1111
display: flex;
12-
flex-direction: column;
13-
padding: 2rem;
12+
flex-direction: ${(props) => (props.isIconInline ? "row" : "column")};
13+
padding: 1.5rem;
1414
border-radius: 4px;
1515
border: solid 1px ${PALETTE.white80};
16-
box-shadow: 0 8px 16px -8px rgba(19, 12, 51, 0.08);
16+
box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.08);
17+
18+
@media (${MEDIA_QUERIES.ltTablet}) {
19+
flex-direction: column;
20+
}
1721
1822
${SubsectionHeader} {
19-
margin-bottom: 0.5rem;
23+
margin-bottom: 0.65rem;
2024
}
2125
2226
img {
2327
display: block;
24-
overflow: hidden;
2528
width: 3rem;
2629
height: 3rem;
2730
border-radius: 50%;
31+
margin-right: 1.5rem;
2832
margin-bottom: 1.5rem;
2933
}
3034
`;
3135

36+
const ContentEl = styled.div``;
37+
3238
/**
3339
* Note: This exports a React component instead of a styled-component.
3440
* [Design Mockup](https://app.zeplin.io/project/5d5aecf2918cf74d46363015/screen/5d813f575d1398783f61df5b)
@@ -41,8 +47,10 @@ const Card = React.forwardRef(function Card(
4147
return (
4248
<CardEl ref={ref} {...props}>
4349
{icon && <img src={icon} alt={title} />}
44-
<SubsectionHeader color={PALETTE.black60}>{title}</SubsectionHeader>
45-
<Text>{children}</Text>
50+
<ContentEl>
51+
<SubsectionHeader>{title}</SubsectionHeader>
52+
<Text>{children}</Text>
53+
</ContentEl>
4654
</CardEl>
4755
);
4856
});
@@ -56,6 +64,10 @@ Card.propTypes = {
5664
* The icon of the card. @TODO
5765
*/
5866
icon: PropTypes.string,
67+
/**
68+
* Set to true if an icon should appear next to the card's content on desktop
69+
*/
70+
isIconInline: PropTypes.bool,
5971
/**
6072
* The copy of the card
6173
*/

src/components/Card.md

+33-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
Card with an icon
2-
3-
```jsx
4-
<Card title="Issue assets" icon="https://via.placeholder.com/48/999999">
5-
Start building on the most powerful payment network today.
6-
</Card>
7-
```
8-
91
Card without an icon
102

113
```jsx
@@ -15,3 +7,36 @@ Card without an icon
157
issue interoperable assets.
168
</Card>
179
```
10+
11+
Card with `isIconInline` set to `true`. This is for cards within only one column
12+
grid on desktop.
13+
14+
```jsx
15+
<Card
16+
title="Issue assets"
17+
icon="https://via.placeholder.com/48/999999"
18+
isIconInline
19+
>
20+
Start building on the most powerful payment network today.
21+
</Card>
22+
```
23+
24+
Card with `isIconInline` set to `false`. This is for cards within multiple
25+
column grid on desktop. On mobile, this design is adopted in all cards.
26+
27+
```jsx
28+
<div
29+
style={{
30+
display: "grid",
31+
gridTemplateColumns: "repeat(2, 1fr)",
32+
gridGap: "20px",
33+
}}
34+
>
35+
<Card title="Issue assets" icon="https://via.placeholder.com/48/999999">
36+
Start building on the most powerful payment network today.
37+
</Card>
38+
<Card title="Issue assets" icon="https://via.placeholder.com/48/999999">
39+
Start building on the most powerful payment network today.
40+
</Card>
41+
</div>
42+
```

src/shared.js

+21
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,24 @@ export const PALETTE = {
1919
black80: "#333333",
2020
purple: "#3e1bdb",
2121
};
22+
23+
export const SCREEN_SIZES = {
24+
mobile: 420,
25+
tablet: 769,
26+
laptop: 1025,
27+
desktop: 1281,
28+
};
29+
30+
export const MEDIA_QUERIES = {
31+
ltMobile: `max-width: ${SCREEN_SIZES.mobile}px`,
32+
gtMobile: `min-width: ${SCREEN_SIZES.mobile}px`,
33+
ltTablet: `max-width: ${SCREEN_SIZES.tablet}px`,
34+
gtTablet: `min-width: ${SCREEN_SIZES.tablet}px`,
35+
ltLaptop: `max-width: ${SCREEN_SIZES.laptop}px`,
36+
gtLaptop: `min-width: ${SCREEN_SIZES.laptop}px`,
37+
ltDesktop: `max-width: ${SCREEN_SIZES.desktop}px`,
38+
gtDesktop: `min-width: ${SCREEN_SIZES.desktop}px`,
39+
40+
canHover: `hover: hover`,
41+
noHover: `hover: none`,
42+
};

0 commit comments

Comments
 (0)