Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Input): update to v1 API #281

Merged
merged 25 commits into from
Sep 28, 2016
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
74a9a24
Input Component updated to v1 API
jhchill666 Jun 24, 2016
1bcd072
fix(Input): fix props references
levithomason Sep 19, 2016
2813a04
refactor(docs): update Input docs to v1 files
levithomason Sep 19, 2016
0081a82
fix(docs): fix input variations typo
levithomason Sep 19, 2016
a2d4a59
refactor(docs): go stateless and rename Input docs
levithomason Sep 20, 2016
486d669
fix(Sidebar): remove input ref
levithomason Sep 20, 2016
5e05f31
docs(Input): update examples to v1 API
levithomason Sep 20, 2016
b011e82
feat(Input): update states to v1 API
levithomason Sep 20, 2016
6bf626d
feat(Input): add v1 icon support
levithomason Sep 21, 2016
952b52d
feat(Input): add labeled support
levithomason Sep 22, 2016
b064979
feat(Input): support labeled inputs
levithomason Sep 23, 2016
da1c0e1
feat(Input): begin labeled and action variations
levithomason Sep 27, 2016
fe63039
fix(docs): cleanup example layout
levithomason Sep 27, 2016
b37952c
feat(Dropdown): add missing `basic` prop
levithomason Sep 27, 2016
5f4c7db
test(Dropdown): add missing className tests
levithomason Sep 27, 2016
029dab7
feat(Input): support action inputs
levithomason Sep 27, 2016
1fedf9b
test(Input): add v1 API tests
levithomason Sep 27, 2016
15f89ce
docs(Input): add icon child example
levithomason Sep 27, 2016
adac980
feat(factories): allow deafultProps function
levithomason Sep 27, 2016
5478c62
refactor(common): complete Input todos
levithomason Sep 27, 2016
fe327fc
fix(docs): fix linter issues
levithomason Sep 27, 2016
59403ea
fix(BreadcrumbDivider-test): restore to original
levithomason Sep 27, 2016
72bf71d
fix(FormField): do not pass label to all controls
levithomason Sep 27, 2016
af405e9
refactor(ExampleSection): restore header style
levithomason Sep 28, 2016
e27f533
refactor(factories): add defaultProps object default
levithomason Sep 28, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions docs/app/Components/ComponentDoc/ComponentExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,27 @@ const showCodeStyle = {
right: '1rem',
}

const descriptionStyle = {
marginRight: '5em',
}

const codeIconStyle = {
fontWeight: 'bold',
}

const titleStyle = {
marginBottom: 0,
margin: 0,
}

const headerColumnStyle = {
// provide room for absolutely positions toggle code icons
minHeight: '4em',
paddingRight: '7em',
}

const childrenStyle = {
paddingTop: 0,
}

const renderedExampleStyle = {
paddingTop: 0,
paddingBottom: 0,
}

/**
Expand Down Expand Up @@ -109,6 +115,8 @@ export default class ComponentExample extends Component {
return (
<Grid style={style} divided={active} columns='1'>
<Grid.Column style={headerColumnStyle}>
{title && <Header as='h3' style={titleStyle}>{title}</Header>}
{description && <p>{description}</p>}
<div style={showCodeStyle}>
<Icon
link
Expand All @@ -126,11 +134,16 @@ export default class ComponentExample extends Component {
onClick={this.toggleShowHTML}
/>
</div>
{title && <Header as='h3' style={titleStyle}>{title}</Header>}
{description && <p style={descriptionStyle}>{description}</p>}
{children}
</Grid.Column>
<Grid.Column className={`rendered-example ${this.getKebabExamplePath()}`}>
{children && (
<Grid.Column style={childrenStyle}>
{children}
</Grid.Column>
)}
<Grid.Column
className={`rendered-example ${this.getKebabExamplePath()}`}
style={renderedExampleStyle}
>
{createElement(this.component, rest)}
</Grid.Column>
{showCode && this.renderCode()}
Expand Down
12 changes: 9 additions & 3 deletions docs/app/Components/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,21 @@ export default class Sidebar extends Component {

componentDidMount() {
document.addEventListener('keydown', this.handleDocumentKeyDown)
this.setSearchInput()
}

componentDidUpdate(prevProps, prevState) {
this.setSearchInput()
}

componentWillUnmount() {
document.removeEventListener('keydown', this.handleDocumentKeyDown)
}

setSearchInput() {
this._searchInput = findDOMNode(this).querySelector('.ui.input input')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Input is now a stateless component, so no refs are available. Updated the doc sidebar to use a regular query selector instead.

}

handleDocumentKeyDown = (e) => {
const code = keyboardKey.getCode(e)
const isAZ = code >= 65 && code <= 90
Expand Down Expand Up @@ -197,9 +206,6 @@ export default class Sidebar extends Component {
value={query}
onChange={this.handleSearchChange}
onKeyDown={this.handleSearchKeyDown}
ref={(c) => {
if (c !== null) this._searchInput = findDOMNode(c).querySelector('input')
}}
/>
</div>
{query ? this.renderSearchItems() : this.menuItemsByType}
Expand Down
8 changes: 2 additions & 6 deletions docs/app/Examples/collections/Menu/Content/Inputs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react'
import { Button, Input, Menu } from 'stardust'

// TODO: Update <Input> usage after update to v1 API
import { Input, Menu } from 'stardust'

const Inputs = () => {
return (
Expand All @@ -11,9 +9,7 @@ const Inputs = () => {
</Menu.Item>

<Menu.Item position='right'>
<Input className='action' placeholder='Navigate to...'>
<Button type='submit'>Go</Button>
</Input>
<Input action={{ type: 'submit', content: 'Go' }} placeholder='Navigate to...' />
</Menu.Item>
</Menu>
)
Expand Down
4 changes: 1 addition & 3 deletions docs/app/Examples/collections/Menu/Types/Pointing.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { Component } from 'react'
import { Input, Menu, Segment } from 'stardust'

// TODO: Update <Input> usage after its update to v1 API

export default class Pointing extends Component {
state = { activeItem: 'home' }

Expand All @@ -19,7 +17,7 @@ export default class Pointing extends Component {
<Menu.Item name='friends' active={activeItem === 'friends'} onClick={this.handleItemClick} />
<Menu.Menu position='right'>
<Menu.Item>
<Input className='icon' icon='search' placeholder='Search...' />
<Input icon='search' placeholder='Search...' />
</Menu.Item>
</Menu.Menu>
</Menu>
Expand Down
4 changes: 1 addition & 3 deletions docs/app/Examples/collections/Menu/Types/Secondary.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { Component } from 'react'
import { Input, Menu } from 'stardust'

// TODO: Update <Input> usage after its update to v1 API

export default class Secondary extends Component {
state = { activeItem: 'home' }

Expand All @@ -18,7 +16,7 @@ export default class Secondary extends Component {
<Menu.Item name='friends' active={activeItem === 'friends'} onClick={this.handleItemClick} />
<Menu.Menu position='right'>
<Menu.Item>
<Input className='icon' icon='search' placeholder='Search...' />
<Input icon='search' placeholder='Search...' />
</Menu.Item>
<Menu.Item name='logout' active={activeItem === 'logout'} onClick={this.handleItemClick} />
</Menu.Menu>
Expand Down
9 changes: 2 additions & 7 deletions docs/app/Examples/collections/Menu/Types/TabularOnTop.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React, { Component } from 'react'
import { Menu, Segment } from 'stardust'

// TODO: Update <Input /> usage after its will implemented
import { Input, Menu, Segment } from 'stardust'

export default class TabularOnTop extends Component {
state = { activeItem: 'bio' }
Expand All @@ -18,10 +16,7 @@ export default class TabularOnTop extends Component {
<Menu.Item name='photos' active={activeItem === 'photos'} onClick={this.handleItemClick} />
<Menu.Menu position='right'>
<Menu.Item>
<div className='ui transparent icon input'>
<input type='text' placeholder='Search users...' />
<i className='search link icon' />
</div>
<Input transparent icon={{ name: 'search', link: 'true' }} placeholder='Search users...' />
</Menu.Item>
</Menu.Menu>
</Menu>
Expand Down
4 changes: 1 addition & 3 deletions docs/app/Examples/collections/Menu/Types/Vertical.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { Component } from 'react'
import { Input, Label, Menu } from 'stardust'

// TODO: Update <Input> usage after its update to v1 API

export default class Vertical extends Component {
state = { activeItem: 'inbox' }

Expand All @@ -28,7 +26,7 @@ export default class Vertical extends Component {
Updates
</Menu.Item>
<Menu.Item>
<Input className='icon' icon='search' placeholder='Search mail...' />
<Input icon='search' placeholder='Search mail...' />
</Menu.Item>
</Menu>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { Component } from 'react'
import { Input, Label, Menu } from 'stardust'

// TODO: Update <Input> usage after its update to v1 API

export default class SizeVerticalLarge extends Component {
state = { activeItem: 'inbox' }

Expand All @@ -28,7 +26,7 @@ export default class SizeVerticalLarge extends Component {
Updates
</Menu.Item>
<Menu.Item>
<Input className='icon' icon='search' placeholder='Search mail...' />
<Input icon='search' placeholder='Search mail...' />
</Menu.Item>
</Menu>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { Component } from 'react'
import { Input, Label, Menu } from 'stardust'

// TODO: Update <Input> usage after its update to v1 API

export default class SizeLargeMassive extends Component {
state = { activeItem: 'inbox' }

Expand All @@ -28,7 +26,7 @@ export default class SizeLargeMassive extends Component {
Updates
</Menu.Item>
<Menu.Item>
<Input className='icon' icon='search' placeholder='Search mail...' />
<Input icon='search' placeholder='Search mail...' />
</Menu.Item>
</Menu>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { Component } from 'react'
import { Input, Label, Menu } from 'stardust'

// TODO: Update <Input> usage after its update to v1 API

export default class SizeVerticalMini extends Component {
state = { activeItem: 'inbox' }

Expand All @@ -28,7 +26,7 @@ export default class SizeVerticalMini extends Component {
Updates
</Menu.Item>
<Menu.Item>
<Input className='icon' icon='search' placeholder='Search mail...' />
<Input icon='search' placeholder='Search mail...' />
</Menu.Item>
</Menu>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { Component } from 'react'
import { Input, Label, Menu } from 'stardust'

// TODO: Update <Input> usage after its update to v1 API

export default class SizeVerticalSmall extends Component {
state = { activeItem: 'inbox' }

Expand All @@ -28,7 +26,7 @@ export default class SizeVerticalSmall extends Component {
Updates
</Menu.Item>
<Menu.Item>
<Input className='icon' icon='search' placeholder='Search mail...' />
<Input icon='search' placeholder='Search mail...' />
</Menu.Item>
</Menu>
)
Expand Down
16 changes: 0 additions & 16 deletions docs/app/Examples/elements/Input/InputExamples.js

This file was deleted.

8 changes: 8 additions & 0 deletions docs/app/Examples/elements/Input/States/InputDisabled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Input } from 'stardust'

const InputDisabled = () => (
<Input disabled placeholder='Search...' />
)

export default InputDisabled
10 changes: 0 additions & 10 deletions docs/app/Examples/elements/Input/States/InputDisabledExample.js

This file was deleted.

8 changes: 8 additions & 0 deletions docs/app/Examples/elements/Input/States/InputError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Input } from 'stardust'

const InputError = () => (
<Input error placeholder='Search...' />
)

export default InputError
10 changes: 0 additions & 10 deletions docs/app/Examples/elements/Input/States/InputErrorExample.js

This file was deleted.

8 changes: 8 additions & 0 deletions docs/app/Examples/elements/Input/States/InputFocus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Input } from 'stardust'

const InputFocus = () => (
<Input focus placeholder='Search...' />
)

export default InputFocus
10 changes: 0 additions & 10 deletions docs/app/Examples/elements/Input/States/InputFocusExample.js

This file was deleted.

8 changes: 8 additions & 0 deletions docs/app/Examples/elements/Input/States/InputLeftLoading.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Input } from 'stardust'

const InputLeftLoading = () => (
<Input loading icon='user' iconPosition='left' placeholder='Search...' />
)

export default InputLeftLoading
8 changes: 8 additions & 0 deletions docs/app/Examples/elements/Input/States/InputLoading.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Input } from 'stardust'

const InputLoading = () => (
<Input loading icon='user' placeholder='Search...' />
)

export default InputLoading
10 changes: 0 additions & 10 deletions docs/app/Examples/elements/Input/States/InputLoadingExample.js

This file was deleted.

Loading