-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into page-layout
- Loading branch information
Showing
35 changed files
with
524 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
# General code owners | ||
* @GoOz @ptbrowne @y-lohse | ||
|
||
# GoOz is responsible for CSS/Stylus files | ||
*.css @GoOz | ||
*.styl @GoOz | ||
|
||
# cpatchane and ptbrowne for React components | ||
*.js @cpatchane @ptbrowne @y-lohse | ||
*.jsx @cpatchane @ptbrowne @y-lohse | ||
* @ptbrowne @y-lohse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
@require '../../stylus/components/avatar' | ||
@require '../../stylus/components/circle' | ||
|
||
.c-avatar | ||
@extend $circle | ||
@extend $avatar | ||
|
||
.c-avatar--xsmall | ||
@extend $avatar--xsmall | ||
@extend $circle--xsmall | ||
|
||
.c-avatar--small | ||
@extend $avatar--small | ||
@extend $circle--small | ||
|
||
.c-avatar--large | ||
@extend $avatar--large | ||
@extend $circle--large | ||
|
||
.c-avatar--xlarge | ||
@extend $avatar--xlarge | ||
@extend $circle--xlarge | ||
|
||
.c-avatar-initials | ||
@extend $avatar-initials | ||
@extend $circle-text | ||
|
||
.c-avatar-image | ||
@extend $avatar-image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
|
||
.o-side | ||
position absolute | ||
top 1.5rem | ||
top 0.5rem | ||
left 0 | ||
width 100% | ||
max-width rem(512) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
### InputGroup with an appended text | ||
|
||
``` | ||
const { Bold } = require('../Text'); | ||
const Input = require('../Input').default; | ||
<form> | ||
<div> | ||
<InputGroup append={<Bold className="u-pr-1">text</Bold>}> | ||
<Input placeholder="Placeholder" /> | ||
</InputGroup> | ||
</div> | ||
</form> | ||
``` | ||
|
||
### InputGroup with a prepended text | ||
|
||
``` | ||
const { Bold } = require('../Text'); | ||
const Input = require('../Input').default; | ||
<form> | ||
<div> | ||
<InputGroup prepend={<Bold className="u-pl-1">text</Bold>}> | ||
<Input placeholder="Placeholder" /> | ||
</InputGroup> | ||
</div> | ||
</form> | ||
``` | ||
|
||
### InputGroup with an appended input | ||
|
||
You will need to set a width to the side component, with a utility class for example. | ||
|
||
``` | ||
const Input = require('../Input').default; | ||
<form> | ||
<div> | ||
<InputGroup append={<Input placeholder="@domain.tld" className="u-w-4"/>}> | ||
<Input placeholder="Email" /> | ||
</InputGroup> | ||
</div> | ||
</form> | ||
``` | ||
|
||
### InputGroup with an appended select | ||
|
||
You will need to set a width to the side component, with a utility class for example. | ||
|
||
``` | ||
const SelectBox = require('../SelectBox').default; | ||
const options = [ | ||
{ value: 'cozy.io', label: '.cozy.io' }, | ||
{ value: 'cozycloud.cc', label: '.cozycloud.cc' } | ||
]; | ||
<form> | ||
<div> | ||
<InputGroup append={<SelectBox inset options={options} className="u-w-4" />}> | ||
<Input placeholder="URL" /> | ||
</InputGroup> | ||
</div> | ||
</form> | ||
``` | ||
|
||
### Full width InputGroup with an appended text | ||
|
||
``` | ||
const { Bold } = require('../Text'); | ||
const Input = require('../Input').default; | ||
<form> | ||
<div> | ||
<InputGroup fullwidth append={<Bold className="u-pr-1">text</Bold>}> | ||
<Input placeholder="Placeholder" /> | ||
</InputGroup> | ||
</div> | ||
</form> | ||
``` | ||
|
||
### Errored InputGroup with an appended text | ||
|
||
``` | ||
const { Bold } = require('../Text'); | ||
const Input = require('../Input').default; | ||
<form> | ||
<div> | ||
<InputGroup error append={<Bold className="u-pr-1">text</Bold>}> | ||
<Input placeholder="Placeholder" /> | ||
</InputGroup> | ||
</div> | ||
</form> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React, { Component } from 'react' | ||
import cx from 'classnames' | ||
import PropTypes from 'prop-types' | ||
import styles from './styles.styl' | ||
|
||
class InputGroup extends Component { | ||
constructor(props) { | ||
super(props) | ||
this.handleFocus = this.handleFocus.bind(this) | ||
this.handleBlur = this.handleBlur.bind(this) | ||
this.state = { | ||
focused: false | ||
} | ||
} | ||
|
||
handleFocus() { | ||
this.setState({ focused: true }) | ||
} | ||
|
||
handleBlur() { | ||
this.setState({ focused: false }) | ||
} | ||
|
||
render() { | ||
const { children, prepend, append, error, fullwidth } = this.props | ||
const { focused } = this.state | ||
return ( | ||
<div | ||
className={cx(styles['c-inputgroup'], { | ||
[styles['c-inputgroup--error']]: error, | ||
[styles['c-inputgroup--fullwidth']]: fullwidth, | ||
[styles['c-inputgroup--focus']]: focused | ||
})} | ||
> | ||
{prepend && ( | ||
<div className={styles['c-inputgroup-side']}>{prepend}</div> | ||
)} | ||
<div className={styles['c-inputgroup-main']}>{children}</div> | ||
{append && <div className={styles['c-inputgroup-side']}>{append}</div>} | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
InputGroup.propTypes = { | ||
prepend: PropTypes.object, | ||
append: PropTypes.object, | ||
error: PropTypes.bool, | ||
fullwidth: PropTypes.bool | ||
} | ||
|
||
InputGroup.defaultProps = { | ||
error: false, | ||
fullwidth: false | ||
} | ||
|
||
export default InputGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@require '../../stylus/components/forms' | ||
|
||
.c-inputgroup | ||
@extend $inputgroup | ||
|
||
input | ||
@extend $inputgroup-input | ||
|
||
.c-inputgroup--focus | ||
@extend $inputgroup--focus | ||
|
||
.c-inputgroup--error | ||
@extend $inputgroup--error | ||
|
||
.c-inputgroup--fullwidth | ||
@extend $inputgroup--fullwidth | ||
|
||
.c-inputgroup-main | ||
@extend $inputgroup-main | ||
|
||
.c-inputgroup-side | ||
@extend $inputgroup-side |
Oops, something went wrong.