Skip to content

Commit

Permalink
feat(input): Add initial styles
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanoglesby08 committed Sep 5, 2017
1 parent cbaa312 commit e94a9c0
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 6 deletions.
5 changes: 3 additions & 2 deletions config/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,11 @@ module.exports = {
{
name: 'Forms',
components() {
return [
return compact([
path.resolve('src/components/Button/Button.jsx'),
toggle(path.resolve('src/components/Input/Input.jsx')),
path.resolve('src/old-components/SelectorCounter/SelectorCounter.jsx')
]
])
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions src/components/Input/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import safeRest from '../../safeRest'

// import styles from './Input.modules.scss'
import styles from './Input.modules.scss'

const textToId = text => text.toLowerCase().replace(/ /g, '-')

Expand Down Expand Up @@ -42,9 +42,9 @@ class Input extends React.Component {

return (
<div>
<label htmlFor={id}>{label}</label>
<label htmlFor={id} className={styles.label}>{label}</label>
<input
{...safeRest(rest)} id={id} type={type}
{...safeRest(rest)} id={id} type={type} className={styles.input}
value={this.state.value} onChange={this.onChange}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/Input.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```
<Input> Input </Input>
<Input label="First name" />
```
41 changes: 41 additions & 0 deletions src/components/Input/Input.modules.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@import '../../scss/settings/colours';
@import '../../scss/settings/typography';

$form-field-border-radius: 4px;

.label {
composes: medium boldFont from '../Typography/Text/Text.modules.scss';

display: block;
margin-bottom: 3px;

color: $color-text;
}

// TODO: All of these are being overridden by forms.scss :(
.input {
width: 100%;
padding: 11px;

outline: 0;
border: 1px solid $color-shuttle-grey;
border-radius: $form-field-border-radius;
box-shadow: 0 1px 8px rgba(0, 0, 0, .05);

font-family: $font-telus;

// TODO: Adjust the font properties to use the Text modules
font-size: rem($body-text-size);
letter-spacing: .4px;
line-height: 1.4;

color: $color-shark;
background-color: $color-white;

transition: background-color .1s linear;

&:focus {
border-color: transparent;
box-shadow: 0 0 4px 1px $color-shuttle-grey;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
exports[`Input renders 1`] = `
<div>
<label
className="label"
htmlFor="the-label"
>
The label
</label>
<input
className="input"
id="the-label"
onChange={[Function]}
type="text"
Expand Down

0 comments on commit e94a9c0

Please sign in to comment.