1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-01 07:30:07 +02:00

baseline composer

This commit is contained in:
Sérgio Ramos 2017-02-15 01:19:26 +00:00 committed by Judit Greskovits
parent 0c74b56791
commit 3ab029248f
92 changed files with 1168 additions and 615 deletions

View File

@ -16,6 +16,7 @@
}, },
"dependencies": { "dependencies": {
"build-array": "^1.0.0", "build-array": "^1.0.0",
"camel-case": "^3.0.0",
"chart.js": "^2.5.0", "chart.js": "^2.5.0",
"chartjs-chart-box-plot": "prerelease", "chartjs-chart-box-plot": "prerelease",
"color": "^1.0.3", "color": "^1.0.3",

View File

@ -1,5 +1,6 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Button = require('../button'); const Button = require('../button');
@ -11,10 +12,20 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const {
baseline
} = composers;
const StyledButton = styled(Button)` const StyledButton = styled(Button)`
position: absolute; position: absolute;
left: ${remcalc(24)}; left: ${remcalc(24)};
bottom: ${remcalc(24)}; bottom: ${remcalc(24)};
${baseline};
`; `;
const AddMetricButton = ({ const AddMetricButton = ({
@ -24,8 +35,8 @@ const AddMetricButton = ({
onClick onClick
}) => { }) => {
const onButtonClick = (e) => onClick(metric); const onButtonClick = (e) => onClick(metric);
return disabled ?
( return disabled ? (
<StyledButton <StyledButton
disabled disabled
name='add-metric-button' name='add-metric-button'
@ -50,4 +61,6 @@ AddMetricButton.propTypes = {
onClick: React.PropTypes.func, onClick: React.PropTypes.func,
}; };
module.exports = AddMetricButton; module.exports = Baseline(
AddMetricButton
);

View File

@ -1,11 +1,16 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const { const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -25,4 +30,6 @@ Description.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Description; module.exports = Baseline(
Description
);

View File

@ -1,10 +1,15 @@
const React = require('react'); const React = require('react');
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledLink = styled.a` const StyledLink = styled.a`
text-decoration: underline; text-decoration: underline;
`; `;
@ -23,4 +28,6 @@ Link.propTypes = {
href: React.PropTypes.string.isRequired href: React.PropTypes.string.isRequired
}; };
module.exports = Link; module.exports = Baseline(
Link
);

View File

@ -1,6 +1,7 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const { const {
@ -9,6 +10,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
remcalc remcalc
} = fns; } = fns;
@ -49,16 +54,16 @@ const StyledTile = styled.div`
const Tile = ({ const Tile = ({
children children
}) => { }) => (
return (
<StyledTile name='add-metric-tile'> <StyledTile name='add-metric-tile'>
{children} {children}
</StyledTile> </StyledTile>
); );
};
Tile.propTypes = { Tile.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Tile; module.exports = Baseline(
Tile
);

View File

@ -1,11 +1,16 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const { const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -27,4 +32,6 @@ Title.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Title; module.exports = Baseline(
Title
);

View File

@ -1,23 +1,32 @@
const constants = require('../../shared/constants');
const React = require('react'); const React = require('react');
const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
base, colors
} = constants.colors; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
const color = (props) => props.secondary const color = (props) => props.secondary
? base.secondary ? colors.base.secondary
: base.primary; : colors.base.primary;
const Anchor = styled.a` const StyledAnchor = styled.a`
color: ${color} !important; color: ${color} !important;
`; `;
const Anchor = Baseline(
StyledAnchor
);
module.exports = Anchor; module.exports = Anchor;
module.exports.fn = (element) => (props) => React.cloneElement(element, { module.exports.fn = (element) => (props) => React.cloneElement(element, {

View File

@ -13,6 +13,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -31,7 +35,7 @@ const Letter = styled.p`
font-weight: 600; font-weight: 600;
`; `;
const Avatar = styled.div` const Container = styled.div`
border-radius: 100%; border-radius: 100%;
display: inline-block; display: inline-block;
overflow: hidden; overflow: hidden;
@ -39,7 +43,7 @@ const Avatar = styled.div`
text-align: center; text-align: center;
`; `;
module.exports = ({ const Avatar = ({
alt, alt,
className, className,
color = '#ACC014', color = '#ACC014',
@ -77,13 +81,13 @@ module.exports = ({
); );
return ( return (
<Avatar className={className} style={_style}> <Container className={className} style={_style}>
{av} {av}
</Avatar> </Container>
); );
}; };
module.exports.propTypes = { Avatar.propTypes = {
alt: React.PropTypes.string, alt: React.PropTypes.string,
className: React.PropTypes.string, className: React.PropTypes.string,
color: React.PropTypes.string, color: React.PropTypes.string,
@ -97,3 +101,7 @@ module.exports.propTypes = {
style: React.PropTypes.object, style: React.PropTypes.object,
width: React.PropTypes.string, width: React.PropTypes.string,
}; };
module.exports = Baseline(
Avatar
);

View File

@ -5,6 +5,7 @@ const React = require('react');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const { const {
default: styled default: styled
@ -14,14 +15,17 @@ const {
colors, colors,
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
remcalc remcalc
} = fns; } = fns;
// If specificity is an issue (i.e nested elements) check base/index.js first // If specificity is an issue (i.e nested elements) check base/index.js first
// before using !important // before using !important
const elements = [ const elements = [{
{
name: 'H1', name: 'H1',
properties: { properties: {
'font-size': remcalc(36), 'font-size': remcalc(36),
@ -31,34 +35,29 @@ const elements = [
'color': colors.base.primaryLight, 'color': colors.base.primaryLight,
'margin': 0 'margin': 0
} }
}, }, {
{
name: 'H2', name: 'H2',
properties: { properties: {
'font-size': remcalc(24), 'font-size': remcalc(24),
} }
}, }, {
{
name: 'H3', name: 'H3',
properties: { properties: {
'font-size': remcalc(16), 'font-size': remcalc(16),
} }
}, }, {
{
name: 'P', name: 'P',
properties: { properties: {
'line-height': remcalc(24), 'line-height': remcalc(24),
'font-size': remcalc(16), 'font-size': remcalc(16),
} }
}, }, {
{
name: 'Small', name: 'Small',
properties: { properties: {
'line-height': remcalc(18), 'line-height': remcalc(18),
'font-size': remcalc(14), 'font-size': remcalc(14),
}, },
} }];
];
/* /*
Loop over each item in element array. Loop over each item in element array.
@ -69,33 +68,34 @@ const elements = [
Usage: Usage:
const H1 = require(base-components).H1; const H1 = require(base-components).H1;
*/ */
const BaseElements = elements.reduce((acc, {
const BaseElements = {}; name = '',
properties = {}
elements.forEach( element => {
const ElementName = element.name;
BaseElements[ElementName] = ({
children,
style
}) => { }) => {
const StyledElement = styled[name.toLowerCase()]`
const StyledElement = styled[element.name.toLowerCase()]` ${properties}
${element.properties}
`; `;
return ( const Component = ({
<StyledElement style={style}> className = '',
children = null,
style = {}
}) => (
<StyledElement className={className} style={style}>
{children} {children}
</StyledElement> </StyledElement>
); );
};
// TODO: Fix proptype validation and remove eslint ignore line 1 // TODO: Fix proptype validation and remove eslint ignore line 1
BaseElements[ElementName].propTypes = { Component.propTypes = {
children: React.PropTypes.node, children: React.PropTypes.node,
style: React.PropTypes.object, style: React.PropTypes.object,
}; };
});
return {
...acc,
[name]: Baseline(Component)
};
}, {});
module.exports = BaseElements; module.exports = BaseElements;

View File

@ -1,10 +1,15 @@
const React = require('react'); const React = require('react');
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledBaselineBackground = styled.div` const StyledBaselineBackground = styled.div`
position: relative; position: relative;
@ -31,7 +36,7 @@ const StyledBaselineBackground = styled.div`
} }
`; `;
const Baseline = ({ const BaselineGrid = ({
children children
}) => ( }) => (
<StyledBaselineBackground> <StyledBaselineBackground>
@ -39,8 +44,10 @@ const Baseline = ({
</StyledBaselineBackground> </StyledBaselineBackground>
); );
Baseline.propTypes = { BaselineGrid.propTypes = {
children: React.PropTypes.node, children: React.PropTypes.node
}; };
module.exports = Baseline; module.exports = Baseline(
BaselineGrid
);

View File

@ -1,37 +0,0 @@
# `<Icon>`
## demo
```embed
const React = require('react');
const ReactDOM = require('react-dom/server');
const Base = require('../base');
const Container = require('../container');
const Row = require('../row');
const Column = require('../column');
const Icon = require('./index.js');
const styles = require('./style.css');
nmodule.exports = ReactDOM.renderToString(
<Base>
<Row>
<Column>
<Icon iconSet='fa' name='beer' />
</Column>
</Row>
</Base>
);
```
## usage
```js
const React = require('react');
const Icon = require('ui/icon');
module.exports = () => {
return (
<Icon iconSet='fa' name='beer' />
);
}
```

View File

@ -0,0 +1,25 @@
const React = require('react');
const {
storiesOf
} = require('@kadira/storybook');
const Base = require('../base');
const BaseElements = require('../base-elements');
const Input = require('../input');
const {
H1
} = BaseElements;
storiesOf('Baseline', module)
.add('margin-left', () => (
<Base>
<H1 marginLeft='2'>Heyo</H1>
</Base>
))
.add('padding', () => (
<Base>
<Input padding='3' />
</Base>
));

View File

@ -1,3 +0,0 @@
.icon {
font-size: inherit;
}

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const isString = require('lodash.isstring'); const isString = require('lodash.isstring');
@ -15,6 +16,10 @@ const {
boxes boxes
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
remcalc remcalc
} = fns; } = fns;
@ -184,4 +189,6 @@ Button.propTypes = {
rr: React.PropTypes.bool rr: React.PropTypes.bool
}; };
module.exports = Button; module.exports = Baseline(
Button
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
@ -7,6 +8,10 @@ const {
boxes boxes
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
remcalc remcalc
} = fns; } = fns;
@ -81,8 +86,7 @@ const Checkbox = ({
selectionDirection, selectionDirection,
style, style,
tabIndex tabIndex
}) => { }) => (
return (
<StyledDiv> <StyledDiv>
<StyledInput <StyledInput
checked={checked} checked={checked}
@ -101,7 +105,6 @@ const Checkbox = ({
</StyledLabel> </StyledLabel>
</StyledDiv> </StyledDiv>
); );
};
Checkbox.propTypes = { Checkbox.propTypes = {
checked: React.PropTypes.bool, checked: React.PropTypes.bool,
@ -119,4 +122,6 @@ Checkbox.propTypes = {
tabIndex: React.PropTypes.string tabIndex: React.PropTypes.string
}; };
module.exports = Checkbox; module.exports = Baseline(
Checkbox
);

View File

@ -1,6 +1,7 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const { const {
@ -11,6 +12,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const StyledButton = styled.button` const StyledButton = styled.button`
background: none; background: none;
border: none; border: none;
@ -21,9 +26,8 @@ const StyledButton = styled.button`
const Close = ({ const Close = ({
style, style,
onClick, onClick
}) => { }) => (
return (
<StyledButton <StyledButton
onClick={onClick} onClick={onClick}
style={style} style={style}
@ -34,11 +38,12 @@ const Close = ({
/> />
</StyledButton> </StyledButton>
); );
};
Close.propTypes = { Close.propTypes = {
onClick: React.PropTypes.func, onClick: React.PropTypes.func,
style: React.PropTypes.object style: React.PropTypes.object
}; };
module.exports = Close; module.exports = Baseline(
Close
);

View File

@ -4,6 +4,7 @@
*/ */
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const isUndefined = require('lodash.isundefined'); const isUndefined = require('lodash.isundefined');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -13,6 +14,10 @@ const {
sizes sizes
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
calc calc
} = fns; } = fns;
@ -60,7 +65,7 @@ const mdOffset = breakpoint('mdOffset', 'medium');
const lg = breakpoint('lg', 'large'); const lg = breakpoint('lg', 'large');
const lgOffset = breakpoint('lgOffset', 'large'); const lgOffset = breakpoint('lgOffset', 'large');
module.exports = styled.div` const Column = styled.div`
box-sizing: border-box; box-sizing: border-box;
padding-left: ${padding}; padding-left: ${padding};
padding-right: ${padding}; padding-right: ${padding};
@ -108,3 +113,7 @@ module.exports = styled.div`
margin-left: ${marginLeft('lgOffset')}; margin-left: ${marginLeft('lgOffset')};
`} `}
`; `;
module.exports = Baseline(
Column
);

View File

@ -3,6 +3,7 @@
* github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Grid.js * github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Grid.js
*/ */
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -11,6 +12,10 @@ const {
sizes sizes
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled, default: styled,
css css
@ -21,7 +26,7 @@ const fluid = (props) => props.fluid && css`
padding-right: ${sizes.outerMargin}; padding-right: ${sizes.outerMargin};
`; `;
module.exports = styled.div` const Container = styled.div`
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
@ -39,3 +44,7 @@ module.exports = styled.div`
max-width: ${sizes.containerLg || '71rem'}; max-width: ${sizes.containerLg || '71rem'};
`} `}
`; `;
module.exports = Baseline(
Container
);

View File

@ -1,7 +1,12 @@
const composers = require('../../shared/composers');
const Column = require('../column'); const Column = require('../column');
const React = require('react'); const React = require('react');
const Row = require('../row'); const Row = require('../row');
const {
Baseline
} = composers;
const LabelRow = (props) => { const LabelRow = (props) => {
const labels = React.Children.map(props.children, (children) => ( const labels = React.Children.map(props.children, (children) => (
<Column xs={12}> <Column xs={12}>
@ -20,4 +25,6 @@ LabelRow.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = LabelRow; module.exports = Baseline(
LabelRow
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -10,11 +11,15 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
module.exports = styled.label` const Label = styled.label`
width: 100%; width: 100%;
font-size: ${remcalc(16)}; font-size: ${remcalc(16)};
font-weight: 600; font-weight: 600;
@ -22,3 +27,7 @@ module.exports = styled.label`
font-stretch: normal; font-stretch: normal;
color: ${colors.base.secondary}; color: ${colors.base.secondary};
`; `;
module.exports = Baseline(
Label
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const Label = require('./label'); const Label = require('./label');
const match = require('../../shared/match'); const match = require('../../shared/match');
@ -8,6 +9,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -19,7 +24,7 @@ const color = match.prop({
})('type'); })('type');
module.exports = styled(Label)` const Msg = styled(Label)`
color: ${color}; color: ${color};
${breakpoints.medium` ${breakpoints.medium`
@ -27,3 +32,7 @@ module.exports = styled(Label)`
text-align: right; text-align: right;
`} `}
`; `;
module.exports = Baseline(
Msg
);

View File

@ -35,7 +35,7 @@ const paddingTop = (props) => props.multiple
? remcalc(20) ? remcalc(20)
: remcalc(13); : remcalc(13);
module.exports = css` const Outlet = css`
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
@ -65,3 +65,5 @@ module.exports = css`
outline: 0; outline: 0;
} }
`; `;
module.exports = Outlet;

View File

@ -1,7 +1,16 @@
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
module.exports = styled.div``; const View = styled.div``;
module.exports = Baseline(
View
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -10,11 +11,15 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
module.exports = styled.li` const Li = styled.li`
display: inline-block; display: inline-block;
& + & { & + & {
@ -33,3 +38,7 @@ module.exports = styled.li`
} }
} }
`; `;
module.exports = Baseline(
Li
);

View File

@ -1,15 +1,24 @@
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const { const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
module.exports = styled.ul` const Ul = styled.ul`
list-style-type: none; list-style-type: none;
margin-bottom: ${remcalc(33)}; margin-bottom: ${remcalc(33)};
`; `;
module.exports = Baseline(
Ul
);

View File

@ -1,5 +1,7 @@
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const reduxFormProxy = require('../../shared/redux-form-proxy'); const reduxFormProxy = require('../../shared/redux-form-proxy');
const composers = require('../../shared/composers');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -13,6 +15,10 @@ const {
rndId rndId
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -78,4 +84,6 @@ Input.propTypes = {
warning: React.PropTypes.string warning: React.PropTypes.string
}; };
module.exports = reduxFormProxy(Input); module.exports = reduxFormProxy(
Baseline(Input)
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -7,6 +8,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled, default: styled,
css css
@ -62,4 +67,6 @@ Description.propTypes = {
collapsed: React.PropTypes.bool collapsed: React.PropTypes.bool
}; };
module.exports = Description; module.exports = Baseline(
Description
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const View = require('./view').raw; const View = require('./view').raw;
@ -7,6 +8,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
remcalc remcalc
} = fns; } = fns;
@ -15,7 +20,7 @@ const {
default: styled default: styled
} = Styled; } = Styled;
module.exports = styled(View)` const GroupView = styled(View)`
display: block; display: block;
padding-top: ${remcalc(62)}; padding-top: ${remcalc(62)};
padding-left: ${remcalc(23)}; padding-left: ${remcalc(23)};
@ -23,3 +28,7 @@ module.exports = styled(View)`
padding-bottom: ${remcalc(5)}; padding-bottom: ${remcalc(5)};
background-color: ${colors.inactive.default}; background-color: ${colors.inactive.default};
`; `;
module.exports = Baseline(
GroupView
);

View File

@ -1,4 +1,5 @@
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const Item = require('./item'); const Item = require('./item');
const React = require('react'); const React = require('react');
@ -12,6 +13,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -58,4 +63,6 @@ Header.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Header; module.exports = Baseline(
Header
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
@ -14,6 +15,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -56,11 +61,14 @@ const Item = styled(Row)`
margin-bottom: ${marginBottom}; margin-bottom: ${marginBottom};
`; `;
module.exports = transferProps([ module.exports = Baseline(
transferProps([
'collapsed', 'collapsed',
'headed' 'headed'
], (props) => ( ], (props) => (
<Item name='list-item' {...props}> <Item name='list-item' {...props}>
{props.children} {props.children}
</Item> </Item>
)); ))
);

View File

@ -3,12 +3,17 @@ const React = require('react');
const Row = require('../row'); const Row = require('../row');
const Styled = require('styled-components'); const Styled = require('styled-components');
const transferProps = require('../../shared/transfer-props'); const transferProps = require('../../shared/transfer-props');
const composers = require('../../shared/composers');
const View = require('./view'); const View = require('./view');
const { const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const md = (props) => props.collapsed const md = (props) => props.collapsed
? 12 ? 12
: 6; : 6;
@ -22,12 +27,11 @@ const InnerRow = styled(Row)`
height: 100%; height: 100%;
`; `;
module.exports = transferProps([ const Meta = transferProps([
'collapsed', 'collapsed',
'headed', 'headed',
'fromHeader' 'fromHeader'
], (props) => { ], (props) => {
const meta = ( const meta = (
<Column <Column
md={md(props)} md={md(props)}
@ -47,3 +51,7 @@ module.exports = transferProps([
</View> </View>
); );
}); });
module.exports = Baseline(
Meta
);

View File

@ -1,4 +1,5 @@
const Button = require('../button'); const Button = require('../button');
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
@ -13,6 +14,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -74,4 +79,6 @@ Options.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Options; module.exports = Baseline(
Options
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const Column = require('../column'); const Column = require('../column');
const Styled = require('styled-components'); const Styled = require('styled-components');
const React = require('react'); const React = require('react');
@ -6,6 +7,10 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const display = (props) => props.collapsed const display = (props) => props.collapsed
? 'none' ? 'none'
: 'block'; : 'block';
@ -29,4 +34,6 @@ Outlet.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Outlet; module.exports = Baseline(
Outlet
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Title = require('./title'); const Title = require('./title');
const React = require('react'); const React = require('react');
@ -7,6 +8,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -51,4 +56,6 @@ Subtitle.propTypes = {
fromHeader: React.PropTypes.bool fromHeader: React.PropTypes.bool
}; };
module.exports = Subtitle; module.exports = Baseline(
Subtitle
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const isString = require('lodash.isstring'); const isString = require('lodash.isstring');
@ -12,6 +13,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -92,4 +97,6 @@ Title.propTypes = {
collapsed: React.PropTypes.bool collapsed: React.PropTypes.bool
}; };
module.exports = Title; module.exports = Baseline(
Title
);

View File

@ -1,13 +1,18 @@
const composers = require('../../shared/composers');
const transferProps = require('../../shared/transfer-props');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
const Row = require('../row'); const Row = require('../row');
const Styled = require('styled-components'); const Styled = require('styled-components');
const transferProps = require('../../shared/transfer-props');
const { const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -44,10 +49,14 @@ View.propTypes = {
headed: React.PropTypes.bool headed: React.PropTypes.bool
}; };
const BaselineView = Baseline(
View
);
module.exports = transferProps([ module.exports = transferProps([
'collapsed', 'collapsed',
'headed', 'headed',
'fromHeader' 'fromHeader'
], View); ], BaselineView);
module.exports.raw = View; module.exports.raw = BaselineView;

View File

@ -2,8 +2,9 @@ const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const CloseIcon = const composers = require('../../shared/composers');
require(
const CloseIcon = require(
'!babel-loader!svg-react-loader!./close.svg?name=CloseIcon' '!babel-loader!svg-react-loader!./close.svg?name=CloseIcon'
); );
@ -15,6 +16,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
colors colors
} = constants; } = constants;
@ -39,8 +44,8 @@ const StyledIcon = styled(CloseIcon)`
const AddMetricButton = ({ const AddMetricButton = ({
onClick onClick
}) => { }) => {
const onButtonClick = (e) => onClick(); const onButtonClick = (e) => onClick();
return ( return (
<StyledButton <StyledButton
name='close-button' name='close-button'
@ -55,4 +60,6 @@ AddMetricButton.propTypes = {
onClick: React.PropTypes.func, onClick: React.PropTypes.func,
}; };
module.exports = AddMetricButton; module.exports = Baseline(
AddMetricButton
);

View File

@ -4,6 +4,7 @@ const moment = require('moment');
const Chart = require('chart.js'); const Chart = require('chart.js');
const whisker = require('chartjs-chart-box-plot'); const whisker = require('chartjs-chart-box-plot');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
whisker(Chart); whisker(Chart);
@ -11,6 +12,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -22,12 +27,9 @@ const Container = styled.div`
background-color: ${colors.base.white}; background-color: ${colors.base.white};
`; `;
const Canvas = styled.canvas` const Canvas = styled.canvas``;
`;
class Graph extends React.Component { class Graph extends React.Component {
componentDidMount() { componentDidMount() {
const { const {
yMax = 100, yMax = 100,
@ -168,7 +170,6 @@ class Graph extends React.Component {
} }
render() { render() {
return ( return (
<Container name='metric-body'> <Container name='metric-body'>
<Canvas <Canvas
@ -189,4 +190,6 @@ Graph.propTypes = {
yMin: React.PropTypes.number yMin: React.PropTypes.number
}; };
module.exports = Graph; module.exports = Baseline(
Graph
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
@ -11,6 +12,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -36,4 +41,6 @@ Header.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Header; module.exports = Baseline(
Header
);

View File

@ -10,7 +10,8 @@ const {
} = fns; } = fns;
const { const {
pseudoEl pseudoEl,
Baseline
} = composers; } = composers;
const { const {
@ -63,8 +64,7 @@ const Select = ({
required, required,
selected, selected,
value value
}) => { }) => (
return (
<SelectWrapper> <SelectWrapper>
<StyledSelect <StyledSelect
autoFocus={autoFocus} autoFocus={autoFocus}
@ -81,7 +81,6 @@ const Select = ({
</StyledSelect> </StyledSelect>
</SelectWrapper> </SelectWrapper>
); );
};
Select.propTypes = { Select.propTypes = {
autoFocus: React.PropTypes.bool, autoFocus: React.PropTypes.bool,
@ -96,4 +95,6 @@ Select.propTypes = {
value: React.PropTypes.string value: React.PropTypes.string
}; };
module.exports = Select; module.exports = Baseline(
Select
);

View File

@ -2,9 +2,10 @@ const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const Button = require('../button'); const Button = require('../button');
const SettingsIcon =
require( const SettingsIcon = require(
'!babel-loader!svg-react-loader!./icon-settings.svg?name=SettingsIcon' '!babel-loader!svg-react-loader!./icon-settings.svg?name=SettingsIcon'
); );
@ -20,6 +21,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const StyledButton = styled(Button)` const StyledButton = styled(Button)`
position: relative; position: relative;
display: flex; display: flex;
@ -54,6 +59,7 @@ const AddMetricButton = ({
onClick onClick
}) => { }) => {
const onButtonClick = (e) => onClick(metric); const onButtonClick = (e) => onClick(metric);
return ( return (
<StyledButton <StyledButton
name='add-metric-button' name='add-metric-button'
@ -71,4 +77,6 @@ AddMetricButton.propTypes = {
onClick: React.PropTypes.func, onClick: React.PropTypes.func,
}; };
module.exports = AddMetricButton; module.exports = Baseline(
AddMetricButton
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -10,12 +11,16 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
//margin: ${remcalc(18)} ${remcalc(24)} !important; //margin: ${remcalc(18)} ${remcalc(24)} !important;
module.exports = styled.h3` const Title = styled.h3`
display: flex; display: flex;
align-self: flex-start; align-self: flex-start;
margin: ${remcalc(18)} auto ${remcalc(18)} ${remcalc(24)} !important; margin: ${remcalc(18)} auto ${remcalc(18)} ${remcalc(24)} !important;
@ -25,3 +30,7 @@ module.exports = styled.h3`
line-height: 1.5; line-height: 1.5;
color: ${colors.base.white}; color: ${colors.base.white};
`; `;
module.exports = Baseline(
Title
);

View File

@ -1,5 +1,7 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -12,6 +14,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -36,4 +42,6 @@ View.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = View; module.exports = Baseline(
View
);

View File

@ -4,6 +4,7 @@ const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const whisker = require('chartjs-chart-box-plot'); const whisker = require('chartjs-chart-box-plot');
const composers = require('../../shared/composers');
whisker(Chart); whisker(Chart);
@ -11,6 +12,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -112,4 +117,6 @@ Graph.propTypes = {
min: React.PropTypes.number min: React.PropTypes.number
}; };
module.exports = Graph; module.exports = Baseline(
Graph
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
@ -11,6 +12,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -38,4 +43,6 @@ Meta.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Meta; module.exports = Baseline(
Meta
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -10,11 +11,15 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
module.exports = styled.p` const Subtitle = styled.p`
margin: 0; margin: 0;
text-align: right; text-align: right;
font-size: ${remcalc(12)}; font-size: ${remcalc(12)};
@ -24,3 +29,7 @@ module.exports = styled.p`
font-stretch: normal; font-stretch: normal;
color: ${colors.regular}; color: ${colors.regular};
`; `;
module.exports = Baseline(
Subtitle
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -10,11 +11,15 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
module.exports = styled.h3` const Title = styled.h3`
margin: 0; margin: 0;
text-align: right; text-align: right;
font-size: ${remcalc(14)}; font-size: ${remcalc(14)};
@ -24,3 +29,7 @@ module.exports = styled.h3`
color: ${colors.semibold}; color: ${colors.semibold};
margin-bottom: ${remcalc(3)} !important; margin-bottom: ${remcalc(3)} !important;
`; `;
module.exports = Baseline(
Title
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
@ -11,6 +12,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -49,4 +54,6 @@ View.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = View; module.exports = Baseline(
View
);

View File

@ -1,6 +1,6 @@
const fns = require('../../shared/functions'); const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -12,6 +12,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -42,12 +46,7 @@ const StyledOverlay = styled.div`
z-index: 1; z-index: 1;
`; `;
const Modal = (props) => { const Modal = (props) => !props.active ? null : (
if (!props.active) {
return null;
}
return (
<div> <div>
<StyledOverlay <StyledOverlay
aria-label='overlay' aria-label='overlay'
@ -60,7 +59,6 @@ const Modal = (props) => {
</StyledModal> </StyledModal>
</div> </div>
); );
};
Modal.propTypes = { Modal.propTypes = {
active: React.PropTypes.bool, active: React.PropTypes.bool,
@ -68,4 +66,6 @@ Modal.propTypes = {
handleDismiss: React.PropTypes.func handleDismiss: React.PropTypes.func
}; };
module.exports = Modal; module.exports = Baseline(
Modal
);

View File

@ -1,6 +1,6 @@
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions');
const composers = require('../../shared/composers'); const composers = require('../../shared/composers');
const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const Close = require('../close'); const Close = require('../close');
@ -19,7 +19,8 @@ const {
const { const {
baseBox, baseBox,
pseudoEl pseudoEl,
Baseline
} = composers; } = composers;
const decorationWidth = remcalc(108); const decorationWidth = remcalc(108);
@ -55,7 +56,9 @@ const Notificaton = ({
type, type,
close close
}) => { }) => {
const renderClose = close ? (<Close onClick={close} />) : null; const renderClose = !close ? null : (
<Close onClick={close} />
);
return ( return (
<StyledNotification <StyledNotification
@ -64,7 +67,6 @@ const Notificaton = ({
type={type} type={type}
> >
{renderClose} {renderClose}
<StyledContent> <StyledContent>
{children} {children}
</StyledContent> </StyledContent>
@ -80,4 +82,6 @@ Notificaton.propTypes = {
type: React.PropTypes.string type: React.PropTypes.string
}; };
module.exports = Notificaton; module.exports = Baseline(
Notificaton
);

View File

@ -5,7 +5,8 @@ const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
baseBox baseBox,
Baseline
} = composers; } = composers;
const { const {
@ -64,7 +65,6 @@ const StyledLi = styled.li`
} }
`; `;
const Pagination = ({ const Pagination = ({
children, children,
className, className,
@ -104,4 +104,6 @@ Pagination.propTypes = {
style: React.PropTypes.object style: React.PropTypes.object
}; };
module.exports = Pagination; module.exports = Baseline(
Pagination
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -5,6 +6,10 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const Container = styled.p` const Container = styled.p`
margin: 0; margin: 0;
line-height: 1.2; line-height: 1.2;
@ -20,4 +25,6 @@ Detail.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Detail; module.exports = Baseline(
Detail
);

View File

@ -1,11 +1,16 @@
const composers = require('../../shared/composers');
const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const fns = require('../../shared/functions');
const { const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -25,4 +30,6 @@ Details.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = Details; module.exports = Baseline(
Details
);

View File

@ -2,11 +2,11 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const MastercardIcon = const MastercardIcon = require(
require(
'!babel-loader!svg-react-loader!./mastercard.svg?name=MastercardIcon' '!babel-loader!svg-react-loader!./mastercard.svg?name=MastercardIcon'
); );
@ -23,6 +23,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const icons = { const icons = {
mastercard: MastercardIcon mastercard: MastercardIcon
}; };
@ -60,15 +64,16 @@ const PaymentCard = ({
type = 'mastercard', type = 'mastercard',
size = 'small' size = 'small'
}) => { }) => {
const icon = React.createElement( const icon = React.createElement(
icons[type], icons[type],
sizes[size] sizes[size]
); );
return size === 'small' ? return size === 'small' ? (
<SmallCard>{icon}</SmallCard> : <SmallCard>{icon}</SmallCard>
<LargeCard>{icon}</LargeCard>; ) : (
<LargeCard>{icon}</LargeCard>
);
}; };
PaymentCard.propTypes = { PaymentCard.propTypes = {
@ -81,4 +86,6 @@ PaymentCard.propTypes = {
]).isRequired ]).isRequired
}; };
module.exports = PaymentCard; module.exports = Baseline(
PaymentCard
);

View File

@ -1,11 +1,16 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const { const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -26,4 +31,6 @@ View.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = View; module.exports = Baseline(
View
);

View File

@ -5,6 +5,7 @@
* if they have any * if they have any
*/ */
const composers = require('../../shared/composers');
const first = require('lodash.first'); const first = require('lodash.first');
const isUndefined = require('lodash.isundefined'); const isUndefined = require('lodash.isundefined');
const get = require('lodash.get'); const get = require('lodash.get');
@ -14,6 +15,10 @@ const classNames = require('classnames');
const React = require('react'); const React = require('react');
// const styles = require('./style.css'); // const styles = require('./style.css');
const {
Baseline
} = composers;
const RadioGroup = React.createClass({ const RadioGroup = React.createClass({
propTypes: { propTypes: {
children: React.PropTypes.node, children: React.PropTypes.node,
@ -150,4 +155,6 @@ const RadioGroup = React.createClass({
} }
}); });
module.exports = RadioGroup; module.exports = Baseline(
RadioGroup
);

View File

@ -1,7 +1,12 @@
const React = require('react'); const React = require('react');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Styled = require('styled-components');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const Styled = require('styled-components');
const {
Baseline
} = composers;
const { const {
remcalc remcalc
@ -47,8 +52,7 @@ const Item = ({
disabled = false, disabled = false,
onClick, onClick,
tabIndex tabIndex
}) => { }) => (
return (
<RadioItem <RadioItem
aria-checked={checked} aria-checked={checked}
aria-disabled={disabled} aria-disabled={disabled}
@ -59,7 +63,6 @@ const Item = ({
{children} {children}
</RadioItem> </RadioItem>
); );
};
Item.propTypes = { Item.propTypes = {
checked: React.PropTypes.bool, checked: React.PropTypes.bool,
@ -70,4 +73,6 @@ Item.propTypes = {
tabIndex: React.PropTypes.number tabIndex: React.PropTypes.number
}; };
module.exports = Item; module.exports = Baseline(
Item
);

View File

@ -1,7 +1,8 @@
const React = require('react');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const Styled = require('styled-components'); const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react');
const Styled = require('styled-components');
const { const {
colors colors
@ -11,6 +12,10 @@ const {
remcalc remcalc
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -78,9 +83,7 @@ const Radio = ({
style, style,
tabIndex, tabIndex,
value value
}) => { }) => (
return (
<StyledLabel style={style}> <StyledLabel style={style}>
<StyledInput <StyledInput
checked={checked} checked={checked}
@ -104,7 +107,6 @@ const Radio = ({
</StyledSpan> </StyledSpan>
</StyledLabel> </StyledLabel>
); );
};
Radio.propTypes = { Radio.propTypes = {
checked: React.PropTypes.bool, checked: React.PropTypes.bool,
@ -125,4 +127,6 @@ Radio.propTypes = {
value: React.PropTypes.string.isRequired value: React.PropTypes.string.isRequired
}; };
module.exports = Radio; module.exports = Baseline(
Radio
);

View File

@ -5,7 +5,8 @@ const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
baseBox baseBox,
Baseline
} = composers; } = composers;
const { const {
@ -133,8 +134,7 @@ const RangeSlider = ({
className, className,
onChange, onChange,
style style
}) => { }) => (
return (
<StyledRange <StyledRange
className={className} className={className}
onChange={onChange} onChange={onChange}
@ -142,7 +142,6 @@ const RangeSlider = ({
type='range' type='range'
/> />
); );
};
RangeSlider.propTypes = { RangeSlider.propTypes = {
className: React.PropTypes.string, className: React.PropTypes.string,
@ -150,4 +149,6 @@ RangeSlider.propTypes = {
style: React.PropTypes.object style: React.PropTypes.object
}; };
module.exports = RangeSlider; module.exports = Baseline(
RangeSlider
);

View File

@ -3,6 +3,7 @@
* github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Row.js * github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Row.js
*/ */
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const match = require('../../shared/match'); const match = require('../../shared/match');
const sizeMatch = require('./size-match'); const sizeMatch = require('./size-match');
@ -13,6 +14,10 @@ const {
sizes sizes
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -51,7 +56,7 @@ const alignItems = (size) => match(sizeMatch(size, {
* <row center top={['xs', 'sm']} first='lg' /> * <row center top={['xs', 'sm']} first='lg' />
* ``` * ```
**/ **/
module.exports = styled.div` const Row = styled.div`
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex: 0 1 auto; flex: 0 1 auto;
@ -88,3 +93,7 @@ module.exports = styled.div`
align-items: ${alignItems('lg')}; align-items: ${alignItems('lg')};
`} `}
`; `;
module.exports = Baseline(
Row
);

View File

@ -1,4 +1,5 @@
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -15,6 +16,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -40,9 +45,7 @@ const SelectCustom = ({
required = false, required = false,
style, style,
value = '' value = ''
}) => { }) => (
return (
<div style={style}> <div style={style}>
<StyledLabel> <StyledLabel>
{label} {label}
@ -60,7 +63,6 @@ const SelectCustom = ({
/> />
</div> </div>
); );
};
SelectCustom.propTypes = { SelectCustom.propTypes = {
async: React.PropTypes.bool, async: React.PropTypes.bool,
@ -81,4 +83,6 @@ SelectCustom.propTypes = {
value: React.PropTypes.string value: React.PropTypes.string
}; };
module.exports = SelectCustom; module.exports = Baseline(
SelectCustom
);

View File

@ -1,5 +1,6 @@
const fns = require('../../shared/functions'); const composers = require('../../shared/composers');
const reduxFormProxy = require('../../shared/redux-form-proxy'); const reduxFormProxy = require('../../shared/redux-form-proxy');
const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -13,6 +14,10 @@ const {
rndId rndId
} = fns; } = fns;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -92,4 +97,6 @@ Select.propTypes = {
warning: React.PropTypes.string warning: React.PropTypes.string
}; };
module.exports = reduxFormProxy(Select); module.exports = reduxFormProxy(
Baseline(Select)
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -7,6 +8,10 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledTitle = styled.h3` const StyledTitle = styled.h3`
text-align: center text-align: center
`; `;
@ -21,21 +26,16 @@ const Table = ({
columns = [], columns = [],
data = [], data = [],
style, style,
title, title
}) => { }) => (
return (
<StyledTableWrapper style={style}> <StyledTableWrapper style={style}>
<StyledTitle>{title}</StyledTitle> <StyledTitle>{title}</StyledTitle>
<TableContent <TableContent
columns={columns} columns={columns}
data={data} data={data}
/> />
</StyledTableWrapper> </StyledTableWrapper>
); );
};
Table.propTypes = { Table.propTypes = {
children: React.PropTypes.node, children: React.PropTypes.node,
@ -45,4 +45,6 @@ Table.propTypes = {
title: React.PropTypes.string, title: React.PropTypes.string,
}; };
module.exports = Table; module.exports = Baseline(
Table
);

View File

@ -7,14 +7,12 @@ const {
const Table = require('./'); const Table = require('./');
const memberDetail = (name) => { const memberDetail = (name) => (
return (
<div> <div>
<h4>{name}</h4> <h4>{name}</h4>
<small>{name}@biztech.com</small> <small>{name}@biztech.com</small>
</div> </div>
); );
};
const columns = [{ const columns = [{
title: 'Memeber', title: 'Memeber',

View File

@ -1,14 +1,19 @@
const composers = require('../../shared/composers');
const React = require('react'); const React = require('react');
const Row = require('./table-row'); const Row = require('./table-row');
const {
Baseline
} = composers;
const TableBody = ({ const TableBody = ({
columns, columns,
data data
}) => { }) => {
const rows = columns.map( (column, index) => { const rows = columns.map((column, index) => (
return <Row dataItem={data[index]} key={index} />; <Row dataItem={data[index]} key={index} />
}); ));
return ( return (
<tbody> <tbody>
@ -22,4 +27,6 @@ TableBody.propTypes = {
data: React.PropTypes.array data: React.PropTypes.array
}; };
module.exports = TableBody; module.exports = Baseline(
TableBody
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -8,6 +9,10 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledTable = styled.table` const StyledTable = styled.table`
width: 100%; width: 100%;
`; `;
@ -18,15 +23,12 @@ const TableContent = ({
hasHeader = columns.length >= 1, hasHeader = columns.length >= 1,
hasBody = data.length >= 1, hasBody = data.length >= 1,
width = '100%' width = '100%'
}) => { }) => (
return (
<StyledTable> <StyledTable>
{hasHeader ? <TableHeader columns={columns} /> : null} {hasHeader ? <TableHeader columns={columns} /> : null}
{hasBody ? <TableBody columns={columns} data={data} /> : null} {hasBody ? <TableBody columns={columns} data={data} /> : null}
</StyledTable> </StyledTable>
); );
};
TableContent.propTypes = { TableContent.propTypes = {
columns: React.PropTypes.array, columns: React.PropTypes.array,
@ -36,4 +38,6 @@ TableContent.propTypes = {
width: React.PropTypes.string, width: React.PropTypes.string,
}; };
module.exports = TableContent; module.exports = Baseline(
TableContent
);

View File

@ -3,6 +3,7 @@ const Styled = require('styled-components');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const { const {
remcalc remcalc
@ -13,6 +14,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -42,17 +47,14 @@ const TableHeader = ({
const fallBackWidth = `${100 / parseInt(columns.length)}%`; const fallBackWidth = `${100 / parseInt(columns.length)}%`;
const titles = columns.map( (column, i) => { const titles = columns.map((column, i) => (
return (
<StyledTableHeadItem <StyledTableHeadItem
key={i} key={i}
mdWidth={column.width || fallBackWidth} mdWidth={column.width || fallBackWidth}
> >
{column.title} {column.title}
</StyledTableHeadItem> </StyledTableHeadItem>
); ));
});
return ( return (
<StyledTableHead> <StyledTableHead>
@ -67,4 +69,6 @@ TableHeader.propTypes = {
columns: React.PropTypes.array columns: React.PropTypes.array
}; };
module.exports = TableHeader; module.exports = Baseline(
TableHeader
);

View File

@ -3,6 +3,7 @@ const Styled = require('styled-components');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const { const {
remcalc remcalc
@ -17,6 +18,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const StyledRow = styled.tr` const StyledRow = styled.tr`
border: solid ${remcalc(1)} ${colors.base.greyDark}; border: solid ${remcalc(1)} ${colors.base.greyDark};
@ -36,13 +41,9 @@ const StyledTableItem = styled.td`
const Row = ({ const Row = ({
dataItem = {} dataItem = {}
}) => { }) => {
const _dataItem = dataItem; const rowItems = Object.keys(dataItem).map((item, i) => (
<StyledTableItem key={i}>{dataItem[item]}</StyledTableItem>
const rowItems = Object.keys(_dataItem).map( (item, i) => { ));
const value = _dataItem[item];
return <StyledTableItem key={i}>{value}</StyledTableItem>;
});
return ( return (
<StyledRow> <StyledRow>
@ -55,4 +56,6 @@ Row.propTypes = {
dataItem: React.PropTypes.object dataItem: React.PropTypes.object
}; };
module.exports = Row; module.exports = Baseline(
Row
);

View File

@ -8,7 +8,8 @@ const {
} = Styled; } = Styled;
const { const {
clearfix clearfix,
Baseline
} = composers; } = composers;
const StyledTableBody = styled.article` const StyledTableBody = styled.article`
@ -20,10 +21,11 @@ const StyledTableBody = styled.article`
const TableBody = ({ const TableBody = ({
children children
}) => { }) => {
const itemCount = children.length; const itemCount = children.length;
if (itemCount <= 1) return; if (itemCount <= 1) {
return null;
}
return ( return (
<StyledTableBody itemCount={itemCount}> <StyledTableBody itemCount={itemCount}>
@ -36,4 +38,6 @@ TableBody.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = StyledTableBody; module.exports = Baseline(
StyledTableBody
);

View File

@ -14,7 +14,8 @@ const {
} = Styled; } = Styled;
const { const {
clearfix clearfix,
Baseline
} = composers; } = composers;
const StyledTableHead = styled.header` const StyledTableHead = styled.header`
@ -39,10 +40,11 @@ const StyledTableHead = styled.header`
const TableHead = ({ const TableHead = ({
children children
}) => { }) => {
const itemCount = children.length; const itemCount = children.length;
if (itemCount <= 1) return; if (itemCount <= 1) {
return null;
}
return ( return (
<StyledTableHead itemCount={itemCount}> <StyledTableHead itemCount={itemCount}>
@ -55,4 +57,6 @@ TableHead.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = TableHead; module.exports = Baseline(
TableHead
);

View File

@ -1,10 +1,16 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const { const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const Item = styled.div` const Item = styled.div`
display: inline-block; display: inline-block;
float: left; float: left;
@ -12,17 +18,16 @@ const Item = styled.div`
const TableItem = ({ const TableItem = ({
children children
}) => { }) => (
return (
<Item className="table-item"> <Item className="table-item">
{children} {children}
</Item> </Item>
); );
};
TableItem.propTypes = { TableItem.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = TableItem; module.exports = Baseline(
TableItem
);

View File

@ -11,7 +11,8 @@ const {
} = Styled; } = Styled;
const { const {
clearfix clearfix,
Baseline
} = composers; } = composers;
const { const {
@ -42,18 +43,16 @@ const StyledTableRow = styled.div`
const TableRow = ({ const TableRow = ({
children children
}) => { }) => (
const itemCount = children.length; <StyledTableRow itemCount={children.length}>
return (
<StyledTableRow itemCount={itemCount}>
{children} {children}
</StyledTableRow> </StyledTableRow>
); );
};
TableRow.propTypes = { TableRow.propTypes = {
children: React.PropTypes.node children: React.PropTypes.node
}; };
module.exports = TableRow; module.exports = Baseline(
TableRow
);

View File

@ -2,6 +2,7 @@ const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const composers = require('../../shared/composers');
const { const {
default: styled default: styled
@ -11,6 +12,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const StyledTableWrapper = styled.section` const StyledTableWrapper = styled.section`
border: solid 1px ${colors.base.greyDark} border: solid 1px ${colors.base.greyDark}
font-family: 'LibreFranklin', sans-serif; font-family: 'LibreFranklin', sans-serif;
@ -20,7 +25,7 @@ const StyledTableWrapper = styled.section`
const Table = ({ const Table = ({
children, children,
style, style,
title, title
}) => ( }) => (
<StyledTableWrapper style={style}> <StyledTableWrapper style={style}>
{children} {children}
@ -33,4 +38,6 @@ Table.propTypes = {
title: React.PropTypes.string, title: React.PropTypes.string,
}; };
module.exports = Table; module.exports = Baseline(
Table
);

View File

@ -1,5 +1,6 @@
const React = require('react'); const React = require('react');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
@ -10,6 +11,10 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledTabs = styled.div` const StyledTabs = styled.div`
font-size: 0; font-size: 0;
@ -54,4 +59,6 @@ Tabs.propTypes = {
style: React.PropTypes.object style: React.PropTypes.object
}; };
module.exports = Tabs; module.exports = Baseline(
Tabs
);

View File

@ -6,7 +6,8 @@ const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
moveZ moveZ,
Baseline
} = composers; } = composers;
const { const {
@ -137,4 +138,6 @@ Tab.propTypes = {
title: React.PropTypes.string title: React.PropTypes.string
}; };
module.exports = Tab; module.exports = Baseline(
Tab
);

View File

@ -15,7 +15,8 @@ const {
} = fns; } = fns;
const { const {
baseBox baseBox,
Baseline
} = composers; } = composers;
const { const {
@ -143,4 +144,6 @@ Textarea.propTypes = {
value: React.PropTypes.string value: React.PropTypes.string
}; };
module.exports = Textarea; module.exports = Baseline(
Textarea
);

View File

@ -9,7 +9,8 @@ const {
} = constants; } = constants;
const { const {
baseBox baseBox,
Baseline
} = composers; } = composers;
const { const {
@ -149,4 +150,6 @@ Toggle.propTypes = {
style: React.PropTypes.object style: React.PropTypes.object
}; };
module.exports = Toggle; module.exports = Baseline(
Toggle
);

View File

@ -2,13 +2,14 @@
const React = require('react'); const React = require('react');
const composers = require('../../shared/composers'); const composers = require('../../shared/composers');
const fns = require('../../shared/functions');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
baseBox, baseBox,
pseudoEl, pseudoEl,
Baseline
} = composers; } = composers;
const { const {
@ -73,7 +74,8 @@ const StyledList = styled.ul`
margin-left: ${remcalc(-12)}; margin-left: ${remcalc(-12)};
} }
`; `;
module.exports = ({
const Tooltip = ({
children, children,
className, className,
style, style,
@ -81,21 +83,23 @@ module.exports = ({
bottom: '100%', bottom: '100%',
left: '10%' left: '10%'
} }
}) => { }) => (
return (
<StyledList <StyledList
arrowPosition={arrowPosition} arrowPosition={arrowPosition}
className={className} className={className}
styles={style} style={style}
> >
{children} {children}
</StyledList> </StyledList>
); );
};
module.exports.propTypes = { Tooltip.propTypes = {
arrowPosition: React.PropTypes.object, arrowPosition: React.PropTypes.object,
children: React.PropTypes.node, children: React.PropTypes.node,
className: React.PropTypes.string, className: React.PropTypes.string,
style: React.PropTypes.object style: React.PropTypes.object
}; };
module.exports = Baseline(
Tooltip
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const d3 = require('d3'); const d3 = require('d3');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
@ -8,6 +9,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
remcalc remcalc
} = fns; } = fns;
@ -413,7 +418,6 @@ class TopologyGraph extends React.Component {
/> />
); );
} }
} }
TopologyGraph.propTypes = { TopologyGraph.propTypes = {
@ -422,4 +426,6 @@ TopologyGraph.propTypes = {
width: React.PropTypes.number, width: React.PropTypes.number,
}; };
module.exports = TopologyGraph; module.exports = Baseline(
TopologyGraph
);

View File

@ -1,3 +1,4 @@
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const React = require('react'); const React = require('react');
@ -7,6 +8,10 @@ const {
colors colors
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
remcalc remcalc
} = fns; } = fns;
@ -30,4 +35,6 @@ Topology.propTypes = {
children: React.PropTypes.node, children: React.PropTypes.node,
}; };
module.exports = Topology; module.exports = Baseline(
Topology
);

View File

@ -1,11 +1,16 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const PropTypes = require('./prop-types'); const PropTypes = require('./prop-types');
const { const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledLine = styled.line` const StyledLine = styled.line`
stroke: #343434; stroke: #343434;
stroke-width: 1.5; stroke-width: 1.5;
@ -151,4 +156,6 @@ GraphLink.propTypes = {
nodeSize: PropTypes.Size nodeSize: PropTypes.Size
}; };
module.exports = GraphLink; module.exports = Baseline(
GraphLink
);

View File

@ -1,10 +1,15 @@
const React = require('react'); const React = require('react');
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledButton = styled.rect` const StyledButton = styled.rect`
opacity: 0; opacity: 0;
cursor: pointer; cursor: pointer;
@ -54,4 +59,6 @@ GraphNodeButton.propTypes = {
onButtonClick: React.PropTypes.func.isRequired onButtonClick: React.PropTypes.func.isRequired
}; };
module.exports = GraphNodeButton; module.exports = Baseline(
GraphNodeButton
);

View File

@ -1,12 +1,13 @@
const React = require('react'); const React = require('react');
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const DataCentresIcon =
require( const DataCentresIcon = require(
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
'!babel-loader!svg-react-loader!./icon-data-centers.svg?name=DataCentresIcon' '!babel-loader!svg-react-loader!./icon-data-centers.svg?name=DataCentresIcon'
); );
const InstancesIcon =
require( const InstancesIcon = require(
'!babel-loader!svg-react-loader!./icon-instances.svg?name=InstancesIcon' '!babel-loader!svg-react-loader!./icon-instances.svg?name=InstancesIcon'
); );
@ -14,6 +15,10 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledText = styled.text` const StyledText = styled.text`
fill: white; fill: white;
font-size: 12px; font-size: 12px;
@ -56,4 +61,6 @@ GraphNodeInfo.propTypes = {
}) })
}; };
module.exports = GraphNodeInfo; module.exports = Baseline(
GraphNodeInfo
);

View File

@ -1,10 +1,15 @@
const React = require('react'); const React = require('react');
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const { const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledText = styled.text` const StyledText = styled.text`
fill: white; fill: white;
font-size: 12px; font-size: 12px;
@ -45,4 +50,6 @@ GraphNodeMetrics.propTypes = {
}) })
}; };
module.exports = GraphNodeMetrics; module.exports = Baseline(
GraphNodeMetrics
);

View File

@ -1,11 +1,12 @@
const React = require('react'); const React = require('react');
const composers = require('../../shared/composers');
const Styled = require('styled-components'); const Styled = require('styled-components');
const PropTypes = require('./prop-types'); const PropTypes = require('./prop-types');
const GraphNodeButton = require('./graph-node-button'); const GraphNodeButton = require('./graph-node-button');
const GraphNodeInfo = require('./graph-node-info'); const GraphNodeInfo = require('./graph-node-info');
const GraphNodeMetrics = require('./graph-node-metrics'); const GraphNodeMetrics = require('./graph-node-metrics');
const HeartIcon =
require( const HeartIcon = require(
'!babel-loader!svg-react-loader!./icon-heart.svg?name=HeartIcon' '!babel-loader!svg-react-loader!./icon-heart.svg?name=HeartIcon'
); );
@ -13,6 +14,10 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const StyledRect = styled.rect` const StyledRect = styled.rect`
stroke: #343434; stroke: #343434;
fill: #464646; fill: #464646;
@ -144,4 +149,6 @@ GraphNode.propTypes = {
size: PropTypes.Size size: PropTypes.Size
}; };
module.exports = GraphNode; module.exports = Baseline(
GraphNode
);

View File

@ -1,5 +1,6 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const Input = require('../input'); const Input = require('../input');
const Select = require('../select'); const Select = require('../select');
const Topology = require('./'); const Topology = require('./');
@ -9,6 +10,10 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const {
Baseline
} = composers;
const { const {
TopologyGraph TopologyGraph
} = Topology; } = Topology;
@ -101,4 +106,6 @@ class StoryHelper extends React.Component {
} }
} }
module.exports = StoryHelper; module.exports = Baseline(
StoryHelper
);

View File

@ -1,5 +1,6 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
const composers = require('../../shared/composers');
const GraphSimulation = require('./graph-simulation'); const GraphSimulation = require('./graph-simulation');
const GraphNode = require('./graph-node'); const GraphNode = require('./graph-node');
const GraphLink = require('./graph-link'); const GraphLink = require('./graph-link');
@ -13,6 +14,10 @@ const {
updateSimulation updateSimulation
} = GraphSimulation; } = GraphSimulation;
const {
Baseline
} = composers;
const StyledSvg = styled.svg` const StyledSvg = styled.svg`
width: 1024px; width: 1024px;
height: 860px; height: 860px;
@ -36,9 +41,7 @@ let dragInfo = {
}; };
class TopologyGraph extends React.Component { class TopologyGraph extends React.Component {
componentWillMount() { componentWillMount() {
const { const {
nodes, nodes,
links links
@ -265,4 +268,6 @@ TopologyGraph.propTypes = {
}) })
}; };
module.exports = TopologyGraph; module.exports = Baseline(
TopologyGraph
);

View File

@ -1,4 +1,5 @@
const React = require('react'); const React = require('react');
const composers = require('../../shared/composers');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -7,6 +8,10 @@ const {
boxes boxes
} = constants; } = constants;
const {
Baseline
} = composers;
const { const {
rndId, rndId,
remcalc remcalc
@ -96,4 +101,6 @@ Widget.propTypes = {
value: React.PropTypes.string value: React.PropTypes.string
}; };
module.exports = Widget; module.exports = Baseline(
Widget
);

View File

@ -1,15 +1,62 @@
const constants = require('./constants');
const Styled = require('styled-components'); const Styled = require('styled-components');
const camelCase = require('camel-case');
const constants = require('./constants');
const fns = require('./functions');
const { const {
boxes boxes
} = constants; } = constants;
const { const {
unitcalc
} = fns;
const {
default: styled,
css css
} = Styled; } = Styled;
const sides = [
'top',
'right',
'bottom',
'left'
];
const unitProps = (() => {
const sided = (rule) =>
sides.map((side) => `${rule}-${side}`);
const measures = [
'margin',
'padding'
].reduce((props, rule) => [
...props,
rule,
...sided(rule)
], []);
return sides.reduce((acc, side) => [
...acc,
`border-${side}-width`
], [
'border',
...measures
]);
})();
const unitsFromProps = (props) => unitProps
.filter((measure) => props[camelCase(measure)])
.map((measure) => `
${measure}: ${unitcalc(props[camelCase(measure)])};
`)
.join(';\n');
module.exports = { module.exports = {
Baseline: (Component) => styled(Component)`
${unitsFromProps}
`,
verticallyAlignCenter: css` verticallyAlignCenter: css`
/* Need to place position:relative on parent */ /* Need to place position:relative on parent */
left: 50%; left: 50%;
@ -58,5 +105,5 @@ module.exports = {
&:after { &:after {
clear:both; clear:both;
} }
`, `
}; };

View File

@ -1,29 +1,22 @@
const selectData = [ const selectData = [{
{
value: 'one', value: 'one',
label: 'One' label: 'One'
}, }, {
{
value: 'two', value: 'two',
label: 'Two' label: 'Two'
}, }, {
{
value: 'three', value: 'three',
label: 'Three' label: 'Three'
}, }, {
{
value: 'four', value: 'four',
label: 'Four' label: 'Four'
}, }, {
{
value: 'five', value: 'five',
label: 'Five' label: 'Five'
}, }, {
{
value: 'six', value: 'six',
label: 'Six' label: 'Six'
} }];
];
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
const profile = 'https://pbs.twimg.com/profile_images/641289584580493312/VBfsPlff_400x400.jpg'; const profile = 'https://pbs.twimg.com/profile_images/641289584580493312/VBfsPlff_400x400.jpg';

View File

@ -1,6 +1,10 @@
const calc = require('reduce-css-calc'); const calc = require('reduce-css-calc');
const randomNatural = require('random-natural'); const randomNatural = require('random-natural');
const pathToFont = './fonts/';
const remBase = 16;
const unitBase = 6;
// from https://github.com/styled-components/styled-components/blob/065001c725744629c7870240e4a955b924ef5337/src/utils/generateAlphabeticName.js // from https://github.com/styled-components/styled-components/blob/065001c725744629c7870240e4a955b924ef5337/src/utils/generateAlphabeticName.js
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
const rndId = (_code) => { const rndId = (_code) => {
@ -14,19 +18,29 @@ const rndId = (_code) => {
: lastDigit; : lastDigit;
}; };
const generateFonts = (fonts) => { const remcalc = (...values) => values.map((value) => (
const pathToFont = './fonts/'; `${String(value).replace('px', '') / remBase}rem`
let fontCSS = ''; )).join(' ');
fonts.forEach((obj) => { const unitcalc = (...values) => values.map(
const eot = require(`${pathToFont + obj.filename}.eot`); (value) => remcalc(value * unitBase)
const woff = require(`${pathToFont + obj.filename}.woff`); );
const woff2 = require(`${pathToFont + obj.filename}.woff2`);
const ttf = require(`${pathToFont + obj.filename}.ttf`); const generateFonts = (fonts) => fonts.reduce((sum, {
const svg = require(`${pathToFont + obj.filename}.svg`); filename,
fontCSS += ` family,
style,
weight
}) => {
const eot = require(`${pathToFont + filename}.eot`);
const woff = require(`${pathToFont + filename}.woff`);
const woff2 = require(`${pathToFont + filename}.woff2`);
const ttf = require(`${pathToFont + filename}.ttf`);
const svg = require(`${pathToFont + filename}.svg`);
sum += `
@font-face { @font-face {
font-family: '${obj.family}'; font-family: '${family}';
src: url('${eot}'), src: url('${eot}'),
url('${eot}?#iefix') url('${eot}?#iefix')
format('embedded-opentype'), format('embedded-opentype'),
@ -36,30 +50,19 @@ const generateFonts = (fonts) => {
format('woff2'), format('woff2'),
url('${ttf}') url('${ttf}')
format('truetype'), format('truetype'),
url('${svg}#${obj.family}') url('${svg}#${family}')
format('svg'); format('svg');
font-weight: ${obj.weight}; font-weight: ${weight};
font-style: ${obj.style}; font-style: ${style};
} }
`; `;
return sum;
}); });
return fontCSS;
};
module.exports = { module.exports = {
remcalc: (values) => { unitcalc: unitcalc,
values = values.toString().replace('px', '').split(' '); remcalc: remcalc,
let outputRems = '';
const base = 16;
values.forEach( (value, i) => {
const remValue = value / base;
outputRems += i === 0 ? `${remValue}rem` : ` ${remValue}rem`;
});
return outputRems;
},
calc: (str) => calc(`calc(${str})`), calc: (str) => calc(`calc(${str})`),
rndId, rndId,
generateFonts generateFonts

View File

@ -1496,6 +1496,13 @@ callsites@^0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca"
camel-case:
version "3.0.0"
resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73"
dependencies:
no-case "^2.2.0"
upper-case "^1.1.1"
camelcase-keys@^2.0.0: camelcase-keys@^2.0.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7"
@ -6803,6 +6810,10 @@ update-notifier@^1.0.0:
semver-diff "^2.0.0" semver-diff "^2.0.0"
xdg-basedir "^2.0.0" xdg-basedir "^2.0.0"
upper-case@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598"
url-loader@^0.5.7: url-loader@^0.5.7:
version "0.5.7" version "0.5.7"
resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.5.7.tgz#67e8779759f8000da74994906680c943a9b0925d" resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.5.7.tgz#67e8779759f8000da74994906680c943a9b0925d"