updating ui components to removing props => props.style. HTML inline style is valid, but should be avoided.

This commit is contained in:
Alex Windett 2017-02-13 12:09:29 +00:00
parent f7b9ea20d0
commit 730b8d27be
10 changed files with 13 additions and 42 deletions

View File

@ -37,8 +37,6 @@ const Avatar = styled.div`
overflow: hidden; overflow: hidden;
position: relative; position: relative;
text-align: center; text-align: center;
${props => props.styles}
`; `;
module.exports = ({ module.exports = ({
@ -79,7 +77,7 @@ module.exports = ({
); );
return ( return (
<Avatar className={className} styles={_style}> <Avatar className={className} style={_style}>
{av} {av}
</Avatar> </Avatar>
); );

View File

@ -26,8 +26,6 @@ const StyledInput = styled.input`
&:disabled + label::after { &:disabled + label::after {
opacity: 0.3; opacity: 0.3;
} }
${props => props.styles}
`; `;
const StyledLabel = styled.label` const StyledLabel = styled.label`
@ -94,7 +92,7 @@ const Checkbox = ({
onChange={onChange} onChange={onChange}
readOnly={readOnly} readOnly={readOnly}
required={required} required={required}
styles={style} style={style}
tabIndex={tabIndex} tabIndex={tabIndex}
type='checkbox' type='checkbox'
/> />

View File

@ -17,8 +17,6 @@ const StyledButton = styled.button`
position: absolute; position: absolute;
top: ${remcalc(16)}; top: ${remcalc(16)};
right: ${remcalc(16)}; right: ${remcalc(16)};
${props => props.styles}
`; `;
const Close = ({ const Close = ({
@ -28,7 +26,7 @@ const Close = ({
return ( return (
<StyledButton <StyledButton
onClick={onClick} onClick={onClick}
styles={style} style={style}
> >
<img <img
alt="Close" alt="Close"

View File

@ -2,21 +2,12 @@
const React = require('react'); const React = require('react');
const ReactRouter = require('react-router-dom'); const ReactRouter = require('react-router-dom');
const Styled = require('styled-components');
const {
default: styled
} = Styled;
const { const {
Link, Link,
Route Route
} = ReactRouter; } = ReactRouter;
const StyledLink = styled(Link)`
${props => props.styles}
`;
const NavLink = ({ const NavLink = ({
activeClassName, activeClassName,
activeStyle, activeStyle,
@ -48,7 +39,7 @@ const NavLink = ({
: className; : className;
return ( return (
<StyledLink <Link
className={clssnm} className={clssnm}
// eslint-disable-next-line object-curly-newline // eslint-disable-next-line object-curly-newline
style={isActive ? { ...style, ...activeStyle } : style} style={isActive ? { ...style, ...activeStyle } : style}
@ -56,7 +47,7 @@ const NavLink = ({
{...rest} {...rest}
> >
{newChildren} {newChildren}
</StyledLink> </Link>
); );
}; };

View File

@ -31,7 +31,6 @@ const StyledNotification = styled.div`
width: 100%; width: 100%;
${baseBox(0)} ${baseBox(0)}
${props => props.styles}
&::before { &::before {
background-color: ${props => colors[props.type] || colors.brandPrimary} background-color: ${props => colors[props.type] || colors.brandPrimary}
@ -61,7 +60,7 @@ const Notificaton = ({
return ( return (
<StyledNotification <StyledNotification
className={className} className={className}
styles={style} style={style}
type={type} type={type}
> >
{ renderClose } { renderClose }

View File

@ -31,10 +31,7 @@ const StyledInput = styled.input`
} }
`; `;
const StyledLabel = styled.label` const StyledLabel = styled.label``;
${props => props.styles}
`;
const StyledContent = styled.div` const StyledContent = styled.div`
margin-left: ${remcalc(45)}; margin-left: ${remcalc(45)};
@ -84,7 +81,7 @@ const Radio = ({
}) => { }) => {
return ( return (
<StyledLabel styles={style}> <StyledLabel style={style}>
<StyledInput <StyledInput
checked={checked} checked={checked}
defaultChecked={defaultChecked} defaultChecked={defaultChecked}

View File

@ -127,8 +127,6 @@ const StyledRange = styled.input`
&:focus::-ms-fill-upper { &:focus::-ms-fill-upper {
${rangeUpper} ${rangeUpper}
} }
${props => props.styles}
`; `;
const RangeSlider = ({ const RangeSlider = ({
@ -140,7 +138,7 @@ const RangeSlider = ({
<StyledRange <StyledRange
className={className} className={className}
onChange={onChange} onChange={onChange}
styles={style} style={style}
type='range' type='range'
/> />
); );

View File

@ -14,8 +14,6 @@ const StyledTitle = styled.h3`
const StyledTableWrapper = styled.section` const StyledTableWrapper = styled.section`
font-family: 'LibreFranklin', sans-serif; font-family: 'LibreFranklin', sans-serif;
font-style: normal; font-style: normal;
${props => props.styles}
`; `;
const Table = ({ const Table = ({
@ -28,7 +26,7 @@ const Table = ({
return ( return (
<StyledTableWrapper styles={style}> <StyledTableWrapper style={style}>
<StyledTitle>{title}</StyledTitle> <StyledTitle>{title}</StyledTitle>
<TableContent <TableContent

View File

@ -15,8 +15,6 @@ 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;
font-style: normal; font-style: normal;
${props => props.styles}
`; `;
const Table = ({ const Table = ({
@ -24,7 +22,7 @@ const Table = ({
style, style,
title, title,
}) => ( }) => (
<StyledTableWrapper styles={style}> <StyledTableWrapper style={style}>
{children} {children}
</StyledTableWrapper> </StyledTableWrapper>
); );

View File

@ -22,10 +22,6 @@ const {
default: styled default: styled
} = Styled; } = Styled;
const StyledDiv = styled.div`
${props => props.styles}
`;
const Label = styled.label` const Label = styled.label`
color: ${props => props.error ? colors.alert : colors.fonts.regular} color: ${props => props.error ? colors.alert : colors.fonts.regular}
`; `;
@ -85,7 +81,7 @@ const Textarea = ({
const _error = error ? (<Error>{error}</Error>) : null; const _error = error ? (<Error>{error}</Error>) : null;
return ( return (
<StyledDiv styles={style}> <div style={style}>
<Label <Label
error={error} error={error}
htmlFor={id} htmlFor={id}
@ -116,7 +112,7 @@ const Textarea = ({
value={value} value={value}
/> />
{_children} {_children}
</StyledDiv> </div>
); );
}; };