Skip to content

Commit

Permalink
Added BlockQuote, updated fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelklaessen committed Jul 28, 2018
1 parent 2b1e368 commit 7080845
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 20 deletions.
5 changes: 5 additions & 0 deletions src/components/BlockQuote/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```js
<BlockQuote>
vx is collection of reusable low-level visualization components.
</BlockQuote>
```
19 changes: 19 additions & 0 deletions src/components/BlockQuote/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import PropTypes from 'prop-types';
import styled from 'react-emotion';
import withTheme from '../ThemeContext/withTheme';

const BlockQuote = styled('blockquote')({
padding: '8px 16px',
lineHeight: 1.8,
color: '#777777',
borderLeft: '2px solid #EFEFEF'
}, ({ theme }) => ({
fontFamily: theme.fontFamily,
fontSize: theme.fontSize
}));

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

export default withTheme(BlockQuote);
8 changes: 5 additions & 3 deletions src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ const Button = styled('button')({
backgroundColor: color
});

styles.push({ fontFamily: bold ? theme.titleFontFamily : theme.fontFamily });

styles.push({ fontWeight: bold ? 800 : 700 });
styles.push({
fontFamily: bold ? theme.titleFontFamily : theme.fontFamily,
fontSize: theme.fontSize,
fontWeight: bold ? 800 : 700
});

if (bold) styles.push({
lineHeight: 1.8,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Card/CardContent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import withTheme from '../../ThemeContext/withTheme';
const CardContent = styled('div')({
lineHeight: 1.8
}, ({ theme }) => ({
fontFamily: theme.fontFamily
fontFamily: theme.fontFamily,
fontSize: theme.fontSize
}));

CardContent.propTypes = {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Card/CardTitle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import withTheme from '../../ThemeContext/withTheme';

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

CardTitle.propTypes = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const Card = styled('article')({
color: black,
backgroundColor: cardGrey
}, ({ theme }) => ({
fontFamily: theme.fontFamily
fontFamily: theme.fontFamily,
fontSize: theme.fontSize
}));

Card.propTypes = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const generateLink = (Component) => {
}
}, ({ theme }) => ({
color: theme.primaryColor,
fontFamily: theme.fontFamily
fontFamily: theme.fontFamily,
fontSize: theme.fontSize
}));

Styled.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```js
<FontProvider>
The correct font is available here!
</FontProvider>
```
14 changes: 14 additions & 0 deletions src/components/ThemeContext/VxThemeProvider/FontProvider/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import PropTypes from 'prop-types';
import styled from 'react-emotion';
import withTheme from '../../withTheme';

const FontProvider = styled('div')(({ theme }) => ({
fontFamily: theme.fontFamily,
fontSize: theme.fontSize
}));

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

export default withTheme(FontProvider);
2 changes: 1 addition & 1 deletion src/components/ThemeContext/VxThemeProvider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
This component sets the ThemeContext which is used by other components. Its use is not obligatory, but if you do use it, use it at the top level of your app.
<br />
<br />
It also sets the <Code>font-family</Code>, thus rendering <Code>font.css</Code> useless.
It also sets the <Code>font-family</Code> and <Code>font-size</Code>, thus rendering <Code>font.css</Code> useless.
</VxThemeProvider>
```
23 changes: 12 additions & 11 deletions src/components/ThemeContext/VxThemeProvider/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import ThemeContext, { defaultTheme } from '../index';
import { defaultFontFamily } from '../../../styles';
import FontProvider from './FontProvider';

const fontStyle = { fontFamily: defaultFontFamily };

const VxThemeProvider = ({ theme, ...props }) => (
<div style={fontStyle}>
<ThemeContext.Provider
value={{ ...defaultTheme, ...theme }}
{...props}
/>
</div>
const VxThemeProvider = ({ theme, children, ...props }) => (
<ThemeContext.Provider
value={{ ...defaultTheme, ...theme }}
{...props}
>
<FontProvider>
{children}
</FontProvider>
</ThemeContext.Provider>
);

VxThemeProvider.propTypes = {
theme: PropTypes.object
theme: PropTypes.object,
children: PropTypes.node
};

export default VxThemeProvider;
1 change: 1 addition & 0 deletions src/components/ThemeContext/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const defaultTheme = {
primaryColor: red,
secondaryColor: darkGrey,
fontFamily: defaultFontFamily,
fontSize: 18,
titleFontFamily
};

Expand Down
1 change: 1 addition & 0 deletions src/font.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 18px;
}

0 comments on commit 7080845

Please sign in to comment.