Skip to content

Commit

Permalink
feat(Input): add v1 icon support
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Sep 21, 2016
1 parent d532e7a commit 9d1619b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/app/Examples/elements/Input/Variations/InputIconElement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'
import { Icon, Input } from 'stardust'

const InputIconElement = () => (
<Input
icon={<Icon name='search' inverted circular link />}
placeholder='Search...'
/>
)

export default InputIconElement
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { Input } from 'stardust'

const InputIconPosition = () => (
<Input icon='users' iconPosition='left' placeholder='Search users...' />
)

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

const InputIconProps = () => (
<Input
icon={{ name: 'search', circular: true, link: true }}
placeholder='Search...'
/>
)

export default InputIconProps
11 changes: 11 additions & 0 deletions docs/app/Examples/elements/Input/Variations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ const InputVariations = () => (
description='An input can be formatted with an icon'
examplePath='elements/Input/Variations/InputIcon'
/>
<ComponentExample
examplePath='elements/Input/Variations/InputIconPosition'
/>
<ComponentExample
description='You can pass an Icon props object'
examplePath='elements/Input/Variations/InputIconProps'
/>
<ComponentExample
description='You can pass an Icon element'
examplePath='elements/Input/Variations/InputIconElement'
/>
<ComponentExample
title='Labeled'
description='An input can be formatted with an label'
Expand Down
5 changes: 4 additions & 1 deletion test/specs/elements/Icon/Icon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as common from 'test/specs/commonTests'
describe('Icon', () => {
common.isConformant(Icon)
common.hasSubComponents(Icon, [IconGroup])
common.rendersChildren(Icon)
common.implementsIconProp(Icon)

common.propKeyOnlyToClassName(Icon, 'bordered')
common.propKeyOnlyToClassName(Icon, 'circular')
Expand All @@ -15,13 +15,16 @@ describe('Icon', () => {
common.propKeyOnlyToClassName(Icon, 'disabled')
common.propKeyOnlyToClassName(Icon, 'fitted')
common.propKeyAndValueToClassName(Icon, 'flipped')
common.propKeyOnlyToClassName(Icon, 'icon')
common.propKeyOnlyToClassName(Icon, 'inverted')
common.propValueOnlyToClassName(Icon, 'name')
common.propKeyOnlyToClassName(Icon, 'link')
common.propKeyOnlyToClassName(Icon, 'loading')
common.propKeyAndValueToClassName(Icon, 'rotated')
common.propValueOnlyToClassName(Icon, 'size')

common.rendersChildren(Icon)

it('renders as an <i> by default', () => {
shallow(<Icon />)
.should.have.tagName('i')
Expand Down

0 comments on commit 9d1619b

Please sign in to comment.