This commit is contained in:
JUDIT GRESKOVITS 2017-01-12 12:39:16 +00:00
commit 4866b3585f
7 changed files with 106 additions and 44 deletions

View File

@ -11,7 +11,7 @@ const {
} = constants; } = constants;
const { const {
remcalc remcalc,
} = fns; } = fns;
const { const {
@ -19,23 +19,37 @@ const {
} = composers; } = composers;
const { const {
default: styled default: styled,
css
} = Styled; } = Styled;
const successBakcground = css`
background-color: ${colors.brandSecondary};
background-image: url("./input-confirm.svg");
background-repeat: no-repeat;
background-position: 98% 20px;
`;
const defaultBackground = css`
background-color: ${colors.brandSecondary};
`;
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}
`; `;
const InputField = styled.input` const InputField = styled.input`
background: ${colors.brandSecondary}; ${baseBox()};
${props => props.success ? successBakcground : defaultBackground }
border-color: ${props => props.error ? colors.alert : 'auto'}
color: ${props => props.error ? colors.alert : colors.fonts.semibold} color: ${props => props.error ? colors.alert : colors.fonts.semibold}
display: block; display: block;
font-size: 16px; font-size: 16px;
padding: ${remcalc('15 18')}; padding: ${remcalc('15 18')};
visibility: visible; visibility: visible;
width: 100%; width: 100%;
${baseBox()};
border-color: ${props => props.error ? colors.alert : ''};
&:focus { &:focus {
border-color: ${boxes.border.checked}; border-color: ${boxes.border.checked};
@ -71,6 +85,7 @@ const Input = ({
selectionDirection, selectionDirection,
spellCheck, spellCheck,
style, style,
success,
tabIndex, tabIndex,
type, type,
value value
@ -106,6 +121,7 @@ const Input = ({
required={required} required={required}
selectionDirection={selectionDirection} selectionDirection={selectionDirection}
spellCheck={spellCheck} spellCheck={spellCheck}
success={success}
tabIndex={tabIndex} tabIndex={tabIndex}
type={type} type={type}
value={value} value={value}
@ -137,6 +153,7 @@ Input.propTypes = {
selectionDirection: React.PropTypes.string, selectionDirection: React.PropTypes.string,
spellCheck: React.PropTypes.bool, spellCheck: React.PropTypes.bool,
style: React.PropTypes.object, style: React.PropTypes.object,
success: React.PropTypes.bool,
tabIndex: React.PropTypes.string, tabIndex: React.PropTypes.string,
type: React.PropTypes.string, type: React.PropTypes.string,
value: React.PropTypes.string value: React.PropTypes.string

View File

@ -28,8 +28,15 @@ storiesOf('Input', module)
<Base> <Base>
<Input <Input
error="Somethings missing" error="Somethings missing"
placeholder="There was an error"
value="alexw/makeusproud.com" value="alexw/makeusproud.com"
/> />
</Base> </Base>
))
.add('Success', () => (
<Base>
<Input
success
value="alexw@makeusproud.com"
/>
</Base>
)); ));

View File

@ -6,15 +6,18 @@ const {
const Tabs = require('./'); const Tabs = require('./');
const Tab = require('./tab'); const Tab = require('./tab');
const Base = require('../base');
storiesOf('Tabs', module) storiesOf('Tabs', module)
.add('Default', () => ( .add('Default', () => (
<Base>
<Tabs name='my-tab-group'> <Tabs name='my-tab-group'>
<Tab title='Containers'> <Tab title='Your Dashboard'>
<h1>Containers</h1> <h1>Containers</h1>
</Tab> </Tab>
<Tab title='Users'> <Tab title='YLD'>
<h1>User</h1> <h1>User</h1>
</Tab> </Tab>
</Tabs> </Tabs>
</Base>
)); ));

View File

@ -10,7 +10,8 @@ const {
} = composers; } = composers;
const { const {
boxes boxes,
colors
} = constants; } = constants;
const { const {
@ -44,9 +45,8 @@ const StyledRadio = styled.input`
&:checked { &:checked {
& + .${classNames.label} { & + .${classNames.label} {
background: #FAFAFA; background: ${colors.brandInactive};
border-bottom-width: 0; border-bottom-width: 0;
padding-bottom: ${remcalc(11)};
${moveZ({ ${moveZ({
amount: 1 amount: 1
@ -60,16 +60,12 @@ const StyledRadio = styled.input`
`; `;
const StyledLabel = styled.label` const StyledLabel = styled.label`
background: #F2F2F2; background: transparent;
border: ${boxes.border.unchecked}; border: 1px solid #D8D8D8;
color: #646464;
display: inline-block; display: inline-block;
font-size: ${remcalc(20)}; font-size: ${remcalc(20)};
left: 1px; padding: ${remcalc('12 25')};
margin-left: -1px; margin-right: 0.5rem;
margin-bottom: 0;
padding: ${remcalc(10)};
position: relative;
vertical-align: bottom; vertical-align: bottom;
`; `;
@ -82,14 +78,15 @@ const StyledPanel = styled.div`
`; `;
const StyledContent = styled.div` const StyledContent = styled.div`
background: #FAFAFA; background: ${colors.brandInactive};
border: ${boxes.border.unchecked}; border: ${boxes.border.unchecked};
box-sizing: border-box; box-sizing: border-box;
box-shadow: 0 -1px 26px 0 rgba(0, 0, 0, 0.2);
display: block; display: block;
float: left; float: left;
font-size: ${remcalc(16)}; font-size: ${remcalc(16)};
margin-top: ${remcalc(-9)}; margin-top: ${remcalc(-9)};
padding: ${remcalc('0 20')}; padding: ${remcalc('20 25')};
width: 100%; width: 100%;
`; `;

View File

@ -83,6 +83,13 @@ const StyledInput1 = styled.input`
} }
`; `;
/*
TODO: Remove !important - it is used to overirde a global style
*/
const StyledLabel = styled.label`
margin-bottom: 0 !important;
`;
const Toggle = ({ const Toggle = ({
checked, checked,
className, className,
@ -120,13 +127,13 @@ const Toggle = ({
}; };
return ( return (
<label <StyledLabel
htmlFor={customProps.id} htmlFor={customProps.id}
key={index} key={index}
> >
{InputVarients[`input_${index}`]} {InputVarients[`input_${index}`]}
<StyledText>{option.label}</StyledText> <StyledText>{option.label}</StyledText>
</label> </StyledLabel>
); );
})} })}
</StyledDiv> </StyledDiv>

View File

@ -4,13 +4,17 @@ const {
storiesOf storiesOf
} = require('@kadira/storybook'); } = require('@kadira/storybook');
const Base = require('../base');
const Toggle = require('./'); const Toggle = require('./');
storiesOf('Toggle', module) storiesOf('Toggle', module)
.add('default', () => ( .add('default', () => (
<Base>
<Toggle checked /> <Toggle checked />
</Base>
)) ))
.add('checked', () => ( .add('checked', () => (
<Base>
<Toggle <Toggle
defaultChecked defaultChecked
options={[ options={[
@ -24,7 +28,10 @@ storiesOf('Toggle', module)
} }
]} ]}
/> />
</Base>
)) ))
.add('no props', () => ( .add('no props', () => (
<Base>
<Toggle /> <Toggle />
</Base>
)); ));

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
<title>icon: confirmation</title>
<desc>Created with Sketch.</desc>
<defs>
<circle id="path-1" cx="9" cy="9" r="9"></circle>
<mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="18" height="18" fill="white">
<use xlink:href="#path-1"></use>
</mask>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="ui-components-revised" transform="translate(-1145.000000, -1341.000000)">
<g id="single-field-line" transform="translate(801.000000, 45.000000)">
<g id="text-field-+-confirmation" transform="translate(0.000000, 1254.000000)">
<g id="icon:-confirmation" transform="translate(344.000000, 42.000000)">
<use id="Oval" stroke="#00AF66" mask="url(#mask-2)" stroke-width="4" xlink:href="#path-1"></use>
<polygon id="tick" fill="#00AF66" points="12.017 5.00007 8.121 10.33607 6.634 8.22707 5 9.37907 8.091 13.76807 13.632 6.17907"></polygon>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB