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

Commit 5b7a286

Browse files
Jeesun KimJeesun Kim
Jeesun Kim
authored and
Jeesun Kim
committed
feature/component/card > Card and Text component added
1 parent 5c37da3 commit 5b7a286

File tree

7 files changed

+89
-4
lines changed

7 files changed

+89
-4
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ To use other components, you need to explicity import them. Reference on
2121
<!-- prettier-ignore -->
2222
````jsx
2323
// ```jsx inside Panel/Readme.md or Panel.md
24-
import { all } from 'dog-names'
25-
import { RandomButton } from '../RandomButton'
26-
;<RandomButton variants={all} />
24+
import { all } from 'dog-names';
25+
import { RandomButton } from '../RandomButton';
26+
<RandomButton variants={all} />
2727
````
2828

2929
## Merging in changes

src/components/Card.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import * as React from "react";
2+
import styled from "styled-components";
3+
import PropTypes from "prop-types";
4+
5+
import { PALETTE } from "../shared";
6+
7+
import Text from "./Text";
8+
import SubsectionHeader from "./SubsectionHeader";
9+
10+
const CardEl = styled.div`
11+
display: flex;
12+
flex-direction: column;
13+
padding: 2rem;
14+
border-radius: 4px;
15+
border: solid 1px ${PALETTE.white80};
16+
box-shadow: 0 8px 16px -8px rgba(19, 12, 51, 0.08);
17+
18+
${SubsectionHeader} {
19+
margin-bottom: 0.5rem;
20+
}
21+
22+
img {
23+
display: block;
24+
overflow: hidden;
25+
width: 3rem;
26+
height: 3rem;
27+
border-radius: 50%;
28+
margin-bottom: 1.5rem;
29+
}
30+
`;
31+
32+
const Card = ({ title, icon, children }) => (
33+
<CardEl>
34+
{icon && <img src={icon} alt={title} />}
35+
<SubsectionHeader color={PALETTE.black60}>{title}</SubsectionHeader>
36+
<Text>{children}</Text>
37+
</CardEl>
38+
);
39+
40+
Card.propTypes = {
41+
/**
42+
* The type of button to show. Don't pass a string; use the object
43+
* `Card.Types` to pass a named constant.
44+
*/
45+
title: PropTypes.string.isRequired,
46+
icon: PropTypes.string,
47+
children: PropTypes.node.isRequired,
48+
};
49+
50+
/** @component */
51+
export default Card;

src/components/Card.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
9+
Card without an icon
10+
11+
```jsx
12+
<Card title="Digital Asset Stack">
13+
Understand how the Stellar node software (Core), API (Horizon), and ecosystem
14+
standards (Stellar Ecosystem Proposals, or SEPs) work together to help you
15+
issue interoperable assets.
16+
</Card>
17+
```

src/components/SubsectionHeader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const SubsectionHeader = styled.h3`
55
font-size: 1.125rem;
66
line-height: 1.5;
77
font-weight: normal;
8-
color: ${PALETTE.black};
8+
color: ${(props) => (props.color ? props.color : PALETTE.black)};
99
margin: 0;
1010
`;
1111

src/components/Text.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import styled from "styled-components";
2+
import { PALETTE } from "../shared";
3+
4+
const Text = styled.p`
5+
font-size: 1rem;
6+
line-height: 1.75;
7+
font-weight: normal;
8+
color: ${PALETTE.black60};
9+
margin: 0;
10+
`;
11+
12+
/** @component */
13+
export default Text;

src/components/Text.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```jsx
2+
<Text>I am a paragraph tag.</Text>
3+
```

src/shared.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const FONT_WEIGHT = {
1212

1313
export const PALETTE = {
1414
white: "#ffffff",
15+
white80: "#fafafa",
1516
black: "#000000",
1617
black30: "#999999",
1718
black60: "#666666",

0 commit comments

Comments
 (0)