Skip to content

Commit

Permalink
Added Card component
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelklaessen committed Jul 28, 2018
1 parent 00cc1ed commit 2b1e368
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export const black = '#000000';
export const white = '#FFFFFF';
export const darkGrey = '#999999';
export const lightGrey = '#EBEBEB';
export const cardGrey = '#F8F8F8';
5 changes: 5 additions & 0 deletions src/components/Card/CardContent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```js
<CardContent>
This package contains a <Code>LinePath</Code> component that can do stuff. This is an example description.
</CardContent>
```
15 changes: 15 additions & 0 deletions src/components/Card/CardContent/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import PropTypes from 'prop-types';
import styled from 'react-emotion';
import withTheme from '../../ThemeContext/withTheme';

const CardContent = styled('div')({
lineHeight: 1.8
}, ({ theme }) => ({
fontFamily: theme.fontFamily
}));

CardContent.propTypes = {
theme: PropTypes.object.isRequired
};

export default withTheme(CardContent);
3 changes: 3 additions & 0 deletions src/components/Card/CardTitle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```js
<CardTitle>@vx/annotation</CardTitle>
```
17 changes: 17 additions & 0 deletions src/components/Card/CardTitle/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import PropTypes from 'prop-types';
import styled from 'react-emotion';
import withTheme from '../../ThemeContext/withTheme';

const CardTitle = styled('h3')({
marginTop: 0,
marginBottom: 12
}, ({ theme }) => ({
color: theme.primaryColor,
fontFamily: theme.fontFamily
}));

CardTitle.propTypes = {
theme: PropTypes.object.isRequired
};

export default withTheme(CardTitle);
10 changes: 10 additions & 0 deletions src/components/Card/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```js
<div style={{ width: 240 }}>
<Card>
<Card.Title>@vx/annotation</Card.Title>
<Card.Content>
This package contains a <Code>LinePath</Code> component that can do stuff. This is an example description.
</Card.Content>
</Card>
</div>
```
25 changes: 25 additions & 0 deletions src/components/Card/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import PropTypes from 'prop-types';
import styled from 'react-emotion';
import { black, cardGrey } from '../../colors';
import CardTitle from './CardTitle';
import CardContent from './CardContent';
import withTheme from '../ThemeContext/withTheme';

const Card = styled('article')({
padding: 12,
color: black,
backgroundColor: cardGrey
}, ({ theme }) => ({
fontFamily: theme.fontFamily
}));

Card.propTypes = {
theme: PropTypes.object.isRequired
};

const ThemedCard = withTheme(Card);

ThemedCard.Title = CardTitle;
ThemedCard.Content = CardContent;

export default ThemedCard;
3 changes: 2 additions & 1 deletion src/components/Code/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import styled from 'react-emotion';
import { lightGrey } from '../../colors';
import { black, lightGrey } from '../../colors';

const Code = styled('code')({
padding: `3.2px 4.8px`,
lineHeight: 1.8,
color: black,
backgroundColor: lightGrey,
fontSize: 14,
fontFamily: '"Menlo", monospace',
Expand Down

0 comments on commit 2b1e368

Please sign in to comment.