Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6197943
Convert List to v1 API
joshuazmiller Jun 28, 2016
6c7a3d6
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust
joshuazmiller Jun 28, 2016
959aff4
Merge branch 'master' into master
joshuazmiller Jun 28, 2016
e1f7042
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust
joshuazmiller Jun 28, 2016
0906e78
Finished refactoring List.js for v1. It works without errors on my ma…
joshuazmiller Jun 28, 2016
5d071df
Merge branch 'master' of https://github.com/joshuazmiller/stardust
joshuazmiller Jun 28, 2016
fdd3113
Renamed _List to List
joshuazmiller Jun 28, 2016
268c3c8
Got rid of ListComponent var and inlined 'div'
joshuazmiller Jun 28, 2016
1e86005
Updated List.js to get rid of 3 Linting errors.
joshuazmiller Jun 28, 2016
7e24d28
List: replaced classNames with declarative props
joshuazmiller Jun 29, 2016
1bd5965
Merge branch 'master' into master
joshuazmiller Jun 29, 2016
681fa30
List: added tests
joshuazmiller Jun 29, 2016
057be3a
Merge remote-tracking branch 'origin/master'
joshuazmiller Jun 29, 2016
d83a3c0
List: refined tests
joshuazmiller Jun 29, 2016
202a8b9
List: corrected lint
joshuazmiller Jun 29, 2016
cd7171d
Supporting env var assignments on Windows
joshuazmiller Jun 29, 2016
bf48ba3
Revert "Supporting env var assignments on Windows"
joshuazmiller Jun 29, 2016
f9ddcd0
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust
joshuazmiller Jun 30, 2016
8245887
Fixing small things based on pull-request #311
joshuazmiller Jun 30, 2016
5b6519f
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust
joshuazmiller Jul 4, 2016
4e7f6c9
feat: add ability to create list items via subcomponents
joshuazmiller Jul 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ export default class ListDescriptionExample extends Component {
header='Nashville'
description='This city is located in the state of Tennessee'
/>
<List.Item>
<List.ItemIcon className='user' />
<List.ItemContent>
<List.ItemHeader>Daniel Louise</List.ItemHeader>
<List.ItemDescription>
This is an example of using sub-components.
</List.ItemDescription>
</List.ItemContent>
</List.Item>
</List>
)
}
Expand Down
10 changes: 10 additions & 0 deletions docs/app/Examples/elements/List/Content/ListHeaderExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ export default class ListHeaderExample extends Component {
<List.Item header='Chapter 1' description='The chapter in which we meet the characters' />
<List.Item header='Chapter 2' description='The chapter in which the bad guy is introduced' />
<List.Item header='Chapter 3' description='Spoiler alert: The chapter in which the good guy wins!' />
<List.Item>
<List.ItemContent>
Copy link
Contributor Author

@joshuazmiller joshuazmiller Jul 4, 2016

Choose a reason for hiding this comment

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

When there is no image/icon do we want to require ItemContent? The current ListItem file suggests no.
ListItem.js: if (media) content = <div className='content'>{content}</div>

Copy link
Member

Choose a reason for hiding this comment

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

Correct, no content when there is no icon/image. Reference the SUI docs for the exact markup.

http://semantic-ui.com/elements/list

In the case of the Item view, adding content with no icon/image will actually break the vertically aligned variations.

<List.ItemHeader>
Chapter 4
</List.ItemHeader>
<List.ItemDescription>
This is an example of a sub-component.
</List.ItemDescription>
</List.ItemContent>
</List.Item>
</List>
)
}
Expand Down
6 changes: 6 additions & 0 deletions docs/app/Examples/elements/List/Content/ListIconExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export default class ListIconExample extends Component {
<List.Item icon={helpIcon}>
This item uses <code>child</code> text, check the code.
</List.Item>
<List.Item>
<List.ItemIcon className='right triangle' />
<List.ItemContent>
This is an example of using sub-components
</List.ItemContent>
</List.Item>
</List>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { List } from 'stardust'
export default class ListBulletedExample extends Component {
render() {
return (
<List className='bulleted'>
<List bulleted>
<List.Item description='Apples' />
<List.Item description='Pears' />
<List.Item description='Oranges' />
Expand Down
2 changes: 1 addition & 1 deletion docs/app/Examples/elements/List/Types/ListLinkExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListLinkExample extends Component {
const link3 = <a>Services</a>
const link4 = <a>Careers</a>
return (
<List className='link'>
<List link>
<List.Item className='active' description={link1} />
<List.Item description={link2} />
<List.Item description={link3} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { List } from 'stardust'
export default class ListOrderedExample extends Component {
render() {
return (
<List className='ordered'>
<List ordered>
<List.Item description='Apples'>
<List>
<List.Item description='Fuji' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListAnimatedExample extends Component {
const avatar2 = <Image className='avatar' src={faker.image.avatar()} />
const avatar3 = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='middle aligned animated'>
<List animated aligned='middle'>
<List.Item image={avatar1} header='Helen' />
<List.Item image={avatar2} header='Christian' />
<List.Item image={avatar3} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListCelledExample extends Component {
const avatar2 = <Image className='avatar' src={faker.image.avatar()} />
const avatar3 = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='celled'>
<List celled>
<List.Item image={avatar1} header='Helen' />
<List.Item image={avatar2} header='Christian' />
<List.Item image={avatar3} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListDividedExample extends Component {
const avatar2 = <Image className='avatar' src={faker.image.avatar()} />
const avatar3 = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='middle aligned divided'>
<List divided aligned='middle'>
<List.Item image={avatar1} header='Helen' />
<List.Item image={avatar2} header='Christian' />
<List.Item image={avatar3} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListHorizontalExample extends Component {
const image2 = <Image className='avatar' src={faker.image.city(100, 100)} />
const image3 = <Image className='avatar' src={faker.image.city(100, 100)} />
return (
<List className='horizontal'>
<List horizontal>
<List.Item image={image1} header='Chicago' description='This city is located in the state of Illinois' />
<List.Item image={image2} header='Indianapolis' description='This city is located in the state of Indiana' />
<List.Item image={image3} header='Nashville' description='This city is located in the state of Tennessee' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class ListInvertedExample extends Component {
render() {
return (
<Segment className='inverted'>
<List className='inverted relaxed divided'>
<List inverted relaxed divided>
<List.Item header='Chicago' description='Located in the state of Illinois' />
<List.Item header='Indianapolis' description='Located in the state of Indiana' />
<List.Item header='Nashville' description='Located in the state of Tennessee' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListRelaxedExample extends Component {
const avatar2 = <Image className='avatar' src={faker.image.avatar()} />
const avatar3 = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='relaxed'>
<List relaxed>
<List.Item image={avatar1} header='Helen' />
<List.Item image={avatar2} header='Christian' />
<List.Item image={avatar3} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListSelectionExample extends Component {
const avatar2 = <Image className='avatar' src={faker.image.avatar()} />
const avatar3 = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='selection'>
<List selection>
<List.Item image={avatar1} header='Helen' />
<List.Item image={avatar2} header='Christian' />
<List.Item image={avatar3} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListSizeBigExample extends Component {
const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='big horizontal divided'>
<List size='big' horizontal divided>
<List.Item image={helenAvatar} header='Helen' />
<List.Item image={christianAvatar} header='Christian' />
<List.Item image={danielAvatar} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListSizeHugeExample extends Component {
const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='huge horizontal divided'>
<List size='huge' horizontal divided>
<List.Item image={helenAvatar} header='Helen' />
<List.Item image={christianAvatar} header='Christian' />
<List.Item image={danielAvatar} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListSizeLargeExample extends Component {
const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='large horizontal divided'>
<List size='large' horizontal divided>
<List.Item image={helenAvatar} header='Helen' />
<List.Item image={christianAvatar} header='Christian' />
<List.Item image={danielAvatar} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListSizeMassiveExample extends Component {
const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='massive horizontal divided'>
<List size='massive' horizontal divided>
<List.Item image={helenAvatar} header='Helen' />
<List.Item image={christianAvatar} header='Christian' />
<List.Item image={danielAvatar} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { Component } from 'react'
import { List, Image } from 'stardust'
import faker from 'faker'

export default class ListSizeLargeExample extends Component {
render() {
const helenAvatar = <Image className='avatar' src={faker.image.avatar()} />
const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
return (
<List size='medium' horizontal divided>
<List.Item image={helenAvatar} header='Helen' />
<List.Item image={christianAvatar} header='Christian' />
<List.Item image={danielAvatar} header='Daniel' />
</List>
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListSizeMiniExample extends Component {
const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='mini horizontal divided'>
<List size='mini' horizontal divided>
<List.Item image={helenAvatar} header='Helen' />
<List.Item image={christianAvatar} header='Christian' />
<List.Item image={danielAvatar} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListSizeSmallExample extends Component {
const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='small horizontal divided'>
<List size='small' horizontal divided>
<List.Item image={helenAvatar} header='Helen' />
<List.Item image={christianAvatar} header='Christian' />
<List.Item image={danielAvatar} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ListSizeTinyExample extends Component {
const christianAvatar = <Image className='avatar' src={faker.image.avatar()} />
const danielAvatar = <Image className='avatar' src={faker.image.avatar()} />
return (
<List className='tiny horizontal divided'>
<List size='tiny' horizontal divided>
<List.Item image={helenAvatar} header='Helen' />
<List.Item image={christianAvatar} header='Christian' />
<List.Item image={danielAvatar} header='Daniel' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default class ListVariationsExamples extends Component {
/>
<ComponentExample examplePath='elements/List/Variations/ListSizeTinyExample' />
<ComponentExample examplePath='elements/List/Variations/ListSizeSmallExample' />
<ComponentExample examplePath='elements/List/Variations/ListSizeMediumExample' />
<ComponentExample examplePath='elements/List/Variations/ListSizeLargeExample' />
<ComponentExample examplePath='elements/List/Variations/ListSizeBigExample' />
<ComponentExample examplePath='elements/List/Variations/ListSizeHugeExample' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class ListVeryRelaxedExample extends Component {
const avatar3 = <Image className='avatar' src={faker.image.avatar()} />

return (
<List className='very relaxed'>
<List relaxed='very'>
<List.Item image={avatar1} header='Helen' />
<List.Item image={avatar2} header='Christian' />
<List.Item image={avatar3} header='Daniel' />
Expand Down
33 changes: 33 additions & 0 deletions src/elements/Content/Content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { PropTypes } from 'react'
import cx from 'classnames'
import META from '../../utils/Meta'

function Content(props) {
const {
children, className, ...rest,
} = props

const classes = cx(
'content',
className
)

return (
<div className={classes} {...rest}>{children}</div>
)
}

Content._meta = {
name: 'Content',
type: META.type.element,
}

Content.propTypes = {
/** Primary content of the List */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realize my comment says List while it should say Content. I've noticed the typos in the Content and Description files and will fix.

children: PropTypes.node,

/** Classes to add to the list className. */
className: PropTypes.string,
}

export default Content
34 changes: 34 additions & 0 deletions src/elements/Description/Description.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { PropTypes } from 'react'
import cx from 'classnames'
import META from '../../utils/Meta'

function Description(props) {
const {
children, className, ...rest,
} = props

const classes = cx(
'description',
className
)

return (
<div className={classes} {...rest}>{children}</div>
)
}

Description._meta = {
library: META.library.semanticUI,
name: 'Description',
type: META.type.element,
}

Description.propTypes = {
/** Primary content of the List */
children: PropTypes.node,

/** Classes to add to the list className. */
className: PropTypes.string,
}

export default Description
2 changes: 1 addition & 1 deletion src/elements/Icon/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export default class Icon extends Component {
render() {
const { className } = this.props
const classes = cx(
className,
'icon',
className
)
return (
<i {...this.props} className={classes} />
Expand Down
38 changes: 38 additions & 0 deletions src/elements/List/ItemHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { PropTypes } from 'react'
import cx from 'classnames'
import META from '../../utils/Meta'

/**
* I'm not sure a seperate file is necessary or if there's a better way.
* Also not sure this is where this file would go.
*/

function ItemHeader(props) {
const {
children, className, ...rest,
} = props

const classes = cx(
'header',
className
)

return (
<div className={classes} {...rest}>{children}</div>
)
}

ItemHeader._meta = {
name: 'ItemHeader',
type: META.type.element,
}

ItemHeader.propTypes = {
/** Primary content of the List */
children: PropTypes.node,

/** Classes to add to the list className. */
className: PropTypes.string,
}

export default ItemHeader
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want this file? Is this where it should be placed or perhaps under views/Item?

Copy link
Member

@levithomason levithomason Jul 7, 2016

Choose a reason for hiding this comment

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

I've left an analysis and proposal for "component parts" on this PR itself: https://github.com/TechnologyAdvice/stardust/pull/311#issuecomment-231006785

Loading