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(Item): add unstackable prop to ItemGroup #1706

Merged
merged 2 commits into from
May 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions docs/app/Examples/views/Item/Variations/ItemExampleUnstackable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import { Item } from 'semantic-ui-react'

const ItemExampleImages = () => (
<Item.Group divided unstackable>
<Item>
<Item.Image src='/assets/images/wireframe/image.png' />
</Item>

<Item>
<Item.Image src='/assets/images/wireframe/image.png' />
</Item>

<Item image='/assets/images/wireframe/image.png' />
</Item.Group>
)

export default ItemExampleImages
6 changes: 6 additions & 0 deletions docs/app/Examples/views/Item/Variations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ const Variations = () => (
/>
<ComponentExample examplePath='views/Item/Variations/ItemExampleVeryRelaxed' />

<ComponentExample
title='Unstackable'
description='A group of items can prevent items from stacking on mobile.'
examplePath='views/Item/Variations/ItemExampleUnstackable'
/>

<ComponentExample
title='Link Item'
description='An item can be formatted so that the entire contents link to another page.'
Expand Down
3 changes: 3 additions & 0 deletions src/views/Item/ItemGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export interface ItemGroupProps {

/** A group of items can relax its padding to provide more negative space. */
relaxed?: boolean | 'very';

/** Prevent items from stacking on mobile. */
unstackable?: boolean;
}

declare const ItemGroup: React.StatelessComponent<ItemGroupProps>;
Expand Down
5 changes: 5 additions & 0 deletions src/views/Item/ItemGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ function ItemGroup(props) {
items,
link,
relaxed,
unstackable,
} = props

const classes = cx(
'ui',
useKeyOnly(divided, 'divided'),
useKeyOnly(link, 'link'),
useKeyOnly(unstackable, 'unstackable'),
useKeyOrValueAndKey(relaxed, 'relaxed'),
'items',
className,
Expand Down Expand Up @@ -81,6 +83,9 @@ ItemGroup.propTypes = {
PropTypes.bool,
PropTypes.oneOf(['very']),
]),

/** Prevent items from stacking on mobile. */
unstackable: PropTypes.bool,
}

export default ItemGroup
1 change: 1 addition & 0 deletions test/specs/views/Item/ItemGroup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('ItemGroup', () => {

common.propKeyOnlyToClassName(ItemGroup, 'divided')
common.propKeyOnlyToClassName(ItemGroup, 'link')
common.propKeyOnlyToClassName(ItemGroup, 'unstackable')

common.propKeyOrValueAndKeyToClassName(ItemGroup, 'relaxed', ['very'])

Expand Down