1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 14:10:04 +02:00

Merge pull request #243 from yldio/fix/inline-styles

Removing HTML inline styling
This commit is contained in:
Alex Windett 2017-02-16 10:15:10 +00:00 committed by GitHub
commit 210e0e40a6
14 changed files with 70 additions and 90 deletions

View File

@ -6,12 +6,17 @@ const constants = require('@ui/shared/constants');
const fns = require('@ui/shared/functions'); const fns = require('@ui/shared/functions');
const Button = require('@ui/components/button'); const Button = require('@ui/components/button');
const BaseElements = require('@ui/components/base-elements');
const Card = require('@ui/components/payment-card'); const Card = require('@ui/components/payment-card');
const { const {
FormattedMessage FormattedMessage
} = ReactIntl; } = ReactIntl;
const {
H2,
} = BaseElements;
const { const {
default: styled default: styled
} = Styled; } = Styled;
@ -35,7 +40,7 @@ const Container = styled.div`
padding: ${remcalc(96)} ${remcalc(40)}; padding: ${remcalc(96)} ${remcalc(40)};
`; `;
const Title = styled.h2` const Title = styled(H2)`
margin: 0 0 ${remcalc(18)} 0; margin: 0 0 ${remcalc(18)} 0;
font-size: ${remcalc(36)}; font-size: ${remcalc(36)};
color: ${colors.brandSecondaryColor}; color: ${colors.brandSecondaryColor};

View File

@ -8,6 +8,11 @@ const fns = require('@ui/shared/functions');
const Input = require('@ui/components/input'); const Input = require('@ui/components/input');
const Button = require('@ui/components/button'); const Button = require('@ui/components/button');
const BaseElements = require('@ui/components/base-elements');
const {
H2,
} = BaseElements;
const { const {
Field Field
@ -33,7 +38,7 @@ const Container = styled.div`
padding: ${remcalc(96)} ${remcalc(40)}; padding: ${remcalc(96)} ${remcalc(40)};
`; `;
const Title = styled.h2` const Title = styled(H2)`
margin: 0 0 ${remcalc(18)} 0; margin: 0 0 ${remcalc(18)} 0;
font-size: ${remcalc(36)}; font-size: ${remcalc(36)};
color: ${colors.brandSecondaryColor}; color: ${colors.brandSecondaryColor};

View File

@ -8,6 +8,11 @@ const fns = require('@ui/shared/functions');
const Input = require('@ui/components/input'); const Input = require('@ui/components/input');
const Button = require('@ui/components/button'); const Button = require('@ui/components/button');
const BaseElements = require('@ui/components/base-elements');
const {
H2,
} = BaseElements;
const { const {
Field Field
@ -33,7 +38,7 @@ const Container = styled.div`
padding: ${remcalc(96)} ${remcalc(40)}; padding: ${remcalc(96)} ${remcalc(40)};
`; `;
const Title = styled.h2` const Title = styled(H2)`
margin: 0 0 ${remcalc(18)} 0; margin: 0 0 ${remcalc(18)} 0;
font-size: ${remcalc(36)}; font-size: ${remcalc(36)};
color: ${colors.brandSecondaryColor}; color: ${colors.brandSecondaryColor};

View File

@ -1,4 +1,5 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components');
const Empty = require('@components/empty/people'); const Empty = require('@components/empty/people');
@ -9,9 +10,13 @@ const Button = require('@ui/components/button');
const PeopleTable = require('./table'); const PeopleTable = require('./table');
const Invite = require('./invite'); const Invite = require('./invite');
const buttonStyle = { const {
float: 'right' default: styled
}; } = Styled;
const StyledButton = styled(Button)`
float: right;
`;
const People = (props) => { const People = (props) => {
const { const {
@ -24,13 +29,12 @@ const People = (props) => {
<div> <div>
<Row> <Row>
<Column md={2} mdOffset={9}> <Column md={2} mdOffset={9}>
<Button <StyledButton
disabled={UI.invite_toggled} disabled={UI.invite_toggled}
onClick={handleToggle} onClick={handleToggle}
style={buttonStyle}
> >
Invite Invite
</Button> </StyledButton>
</Column> </Column>
</Row> </Row>

View File

@ -72,10 +72,10 @@ const Invite = React.createClass({
const { const {
handleToggle, handleToggle,
// UI = {},
// people = [],
} = this.props; } = this.props;
// TODO: When removing react-select css
// change this to styled-components format
const InputStyle = { const InputStyle = {
float: 'left', float: 'left',
width: '75%', width: '75%',
@ -84,14 +84,14 @@ const Invite = React.createClass({
paddingTop: '10px' paddingTop: '10px'
}; };
const AddButtonStyle = { const StyledSubmitButton = styled(Button)`
float: 'right', float: right;
width: '20%' width: 20%;
}; `;
const styleInline = { const StyledInlineButton = styled(Button)`
display: 'inline-block' display: inline-block;
}; `;
const selectData = this.getFormattedPlatformMembers(); const selectData = this.getFormattedPlatformMembers();
@ -121,30 +121,26 @@ const Invite = React.createClass({
value={this.state.selectValue} value={this.state.selectValue}
/> />
</SelectWrapper> </SelectWrapper>
<Button <StyledSubmitButton
secondary secondary
style={AddButtonStyle}
type="submit" type="submit"
> >
Add Add
</Button> </StyledSubmitButton>
</form> </form>
</Column> </Column>
</Row> </Row>
<Button <StyledInlineButton
onClick={handleToggle} onClick={handleToggle}
secondary secondary
style={styleInline}
> >
Cancel Cancel
</Button> </StyledInlineButton>
<Button <StyledInlineButton>
style={styleInline}
>
Send Invitation(s) Send Invitation(s)
</Button> </StyledInlineButton>
</Column> </Column>
</Row> </Row>
); );

View File

@ -1,13 +1,18 @@
const React = require('react'); const React = require('react');
const Styled = require('styled-components');
const Tooltip = require('@ui/components/tooltip'); const Tooltip = require('@ui/components/tooltip');
const tooltipStyle = { const {
position: 'absolute', default: styled
top: '30px', } = Styled;
zIndex: 1,
right: '-36px', const StyledTooltip = styled(Tooltip)`
}; position: absolute;
top: 30px;
z-index: 1;
right: -36px;
`;
const arrowPosition = { const arrowPosition = {
bottom: '100%', bottom: '100%',
@ -51,13 +56,12 @@ module.exports = ({
}); });
return ( return (
<Tooltip <StyledTooltip
arrowPosition={arrowPosition} arrowPosition={arrowPosition}
key={person.uuid} key={person.uuid}
style={tooltipStyle}
> >
{_options} {_options}
</Tooltip> </StyledTooltip>
); );
}; };

View File

@ -17,18 +17,14 @@ const StyledButton = styled.button`
position: absolute; position: absolute;
top: ${remcalc(16)}; top: ${remcalc(16)};
right: ${remcalc(16)}; right: ${remcalc(16)};
${props => props.customStyles ? props.customStyles : null}
`; `;
const Close = ({ const Close = ({
style, style,
onClick, onClick,
customStyles = ''
}) => { }) => {
return ( return (
<StyledButton <StyledButton
customStyles={customStyles}
onClick={onClick} onClick={onClick}
style={style} style={style}
> >
@ -41,7 +37,6 @@ const Close = ({
}; };
Close.propTypes = { Close.propTypes = {
customStyles: React.PropTypes.string,
onClick: React.PropTypes.func, onClick: React.PropTypes.func,
style: React.PropTypes.object style: React.PropTypes.object
}; };

View File

@ -1,19 +1,15 @@
const React = require('react'); const React = require('react');
// const composers = require('../../shared/composers');
const fns = require('../../shared/functions'); const fns = require('../../shared/functions');
const Styled = require('styled-components'); const Styled = require('styled-components');
const constants = require('../../shared/constants'); const constants = require('../../shared/constants');
// const {
// verticallyAlignCenter
// } = composers;
const { const {
remcalc remcalc
} = fns; } = fns;
const { const {
boxes boxes,
colors
} = constants; } = constants;
const { const {
@ -21,7 +17,7 @@ const {
} = Styled; } = Styled;
const RadioItem = styled.div` const RadioItem = styled.div`
background: #FFFFFF; background: ${colors.base.white};
border: ${boxes.border.unchecked}; border: ${boxes.border.unchecked};
cursor: pointer; cursor: pointer;
flaot: left; flaot: left;

View File

@ -1,33 +0,0 @@
~boxes: "../../shared/constants.js";
~colors: "../../shared/constants.js";
:root {
--border-checked: ~boxes.border.checked;
--border-unchecked: ~boxes.border.unchecked;
--border-radius: remcalc(~boxes.borderRadius);
--bottom-shaddow: ~boxes.bottomShaddow;
}
.group {
& .item {
background: #FFFFFF;
cursor: pointer;
margin-bottom: remcalc(15);
padding: remcalc(25);
@add-mixin create-base-box-properties;
&:last-child {
margin-bottom: initial;
}
&.checked {
border: var(--border-checked);
box-shadow: var(--bottom-shaddow);
}
&.disabled {
cursor: default;
}
}
}

View File

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

View File

@ -20,12 +20,13 @@ const Table = ({
children, children,
columns = [], columns = [],
data = [], data = [],
style,
title, title,
}) => { }) => {
return ( return (
<StyledTableWrapper> <StyledTableWrapper style={style}>
<StyledTitle>{title}</StyledTitle> <StyledTitle>{title}</StyledTitle>
<TableContent <TableContent
@ -40,6 +41,7 @@ Table.propTypes = {
children: React.PropTypes.node, children: React.PropTypes.node,
columns: React.PropTypes.array, columns: React.PropTypes.array,
data: React.PropTypes.array, data: React.PropTypes.array,
style: React.PropTypes.object,
title: React.PropTypes.string, title: React.PropTypes.string,
}; };

View File

@ -19,15 +19,17 @@ const StyledTableWrapper = styled.section`
const Table = ({ const Table = ({
children, children,
style,
title, title,
}) => ( }) => (
<StyledTableWrapper> <StyledTableWrapper style={style}>
{children} {children}
</StyledTableWrapper> </StyledTableWrapper>
); );
Table.propTypes = { Table.propTypes = {
children: React.PropTypes.node, children: React.PropTypes.node,
style: React.PropTypes.object,
title: React.PropTypes.string, title: React.PropTypes.string,
}; };

View File

@ -81,7 +81,7 @@ const Textarea = ({
const _error = error ? (<Error>{error}</Error>) : null; const _error = error ? (<Error>{error}</Error>) : null;
return ( return (
<div> <div style={style}>
<Label <Label
error={error} error={error}
htmlFor={id} htmlFor={id}

View File

@ -39,7 +39,7 @@ const StyledList = styled.ul`
padding: ${remcalc(ulPadder)}; padding: ${remcalc(ulPadder)};
min-width: ${remcalc(200)}; min-width: ${remcalc(200)};
${props => props.style} ${props => props.styles}
${baseBox()} ${baseBox()}
@ -86,7 +86,7 @@ module.exports = ({
<StyledList <StyledList
arrowPosition={arrowPosition} arrowPosition={arrowPosition}
className={className} className={className}
style={style} styles={style}
> >
{children} {children}
</StyledList> </StyledList>