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

breaking(Image): Inconsistent prop usage between Image and Icon for circular shape #2225

Merged
merged 5 commits into from
Oct 22, 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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TableExampleCollapsing = () => (
<Table.Row>
<Table.Cell>
<Header as='h4' image>
<Image src='/assets/images/avatar/small/lena.png' shape='rounded' size='mini' />
<Image src='/assets/images/avatar/small/lena.png' rounded size='mini' />
<Header.Content>
Lena
<Header.Subheader>Human Resources</Header.Subheader>
Expand All @@ -28,7 +28,7 @@ const TableExampleCollapsing = () => (
<Table.Row>
<Table.Cell>
<Header as='h4' image>
<Image src='/assets/images/avatar/small/matthew.png' shape='rounded' size='mini' />
<Image src='/assets/images/avatar/small/matthew.png' rounded size='mini' />
<Header.Content>
Matthew
<Header.Subheader>Fabric Design</Header.Subheader>
Expand All @@ -42,7 +42,7 @@ const TableExampleCollapsing = () => (
<Table.Row>
<Table.Cell>
<Header as='h4' image>
<Image src='/assets/images/avatar/small/lindsay.png' shape='rounded' size='mini' />
<Image src='/assets/images/avatar/small/lindsay.png' rounded size='mini' />
<Header.Content>
Lindsay
<Header.Subheader>Entertainment</Header.Subheader>
Expand All @@ -56,7 +56,7 @@ const TableExampleCollapsing = () => (
<Table.Row>
<Table.Cell>
<Header as='h4' image>
<Image src='/assets/images/avatar/small/mark.png' shape='rounded' size='mini' />
<Image src='/assets/images/avatar/small/mark.png' rounded size='mini' />
<Header.Content>
Mark
<Header.Subheader>Executive</Header.Subheader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Header, Image } from 'semantic-ui-react'

const HeaderExampleImage = () => (
<Header as='h2'>
<Image shape='circular' src='/assets/images/avatar/large/patrick.png' />
<Image circular src='/assets/images/avatar/large/patrick.png' />
{' '}Patrick
</Header>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { Image } from 'semantic-ui-react'

const ImageExampleCircular = () => (
<Image src='/assets/images/wireframe/square-image.png' size='medium' shape='circular' />
<Image src='/assets/images/wireframe/square-image.png' size='medium' circular />
)

export default ImageExampleCircular
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { Image } from 'semantic-ui-react'

const ImageExampleRounded = () => (
<Image src='/assets/images/wireframe/square-image.png' size='medium' shape='rounded' />
<Image src='/assets/images/wireframe/square-image.png' size='medium' rounded />
)

export default ImageExampleRounded
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Image, Reveal } from 'semantic-ui-react'
const RevealExampleRotate = () => (
<Reveal animated='rotate'>
<Reveal.Content visible>
<Image shape='circular' size='small' src='/assets/images/wireframe/square-image.png' />
<Image circular size='small' src='/assets/images/wireframe/square-image.png' />
</Reveal.Content>
<Reveal.Content hidden>
<Image shape='circular' size='small' src='/assets/images/avatar/large/stevie.jpg' />
<Image circular size='small' src='/assets/images/avatar/large/stevie.jpg' />
</Reveal.Content>
</Reveal>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Image, Reveal } from 'semantic-ui-react'
const RevealExampleRotateLeft = () => (
<Reveal animated='rotate left'>
<Reveal.Content visible>
<Image shape='circular' size='small' src='/assets/images/wireframe/square-image.png' />
<Image circular size='small' src='/assets/images/wireframe/square-image.png' />
</Reveal.Content>
<Reveal.Content hidden>
<Image shape='circular' size='small' src='/assets/images/avatar/large/veronika.jpg' />
<Image circular size='small' src='/assets/images/avatar/large/veronika.jpg' />
</Reveal.Content>
</Reveal>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const StatisticExampleValue = () => (

<Statistic>
<Statistic.Value>
<Image src='/assets/images/avatar/small/joe.jpg' inline shape='circular' />
<Image src='/assets/images/avatar/small/joe.jpg' inline circular />
42
</Statistic.Value>
<Statistic.Label>Team Members</Statistic.Label>
Expand Down
8 changes: 4 additions & 4 deletions docs/app/Layouts/ResponsiveLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ const ResponsiveLayout = () => (
<Table.Cell>
<Header as='h4' image>
<Image
shape='rounded'
rounded
size='mini'
src='/assets/images/wireframe/square-image.png'
/>
Expand All @@ -590,7 +590,7 @@ const ResponsiveLayout = () => (
<Table.Cell>
<Header as='h4' image>
<Image
shape='rounded'
rounded
size='mini'
src='/assets/images/wireframe/square-image.png'
/>
Expand All @@ -608,7 +608,7 @@ const ResponsiveLayout = () => (
<Table.Cell>
<Header as='h4' image>
<Image
shape='rounded'
rounded
size='mini'
src='/assets/images/wireframe/square-image.png'
/>
Expand All @@ -626,7 +626,7 @@ const ResponsiveLayout = () => (
<Table.Cell>
<Header as='h4' image>
<Image
shape='rounded'
rounded
size='mini'
src='/assets/images/wireframe/square-image.png'
/>
Expand Down
7 changes: 5 additions & 2 deletions src/elements/Image/Image.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export interface ImageProps {
/** Primary content. */
children?: React.ReactNode;

/** An image may appear circular. */
circular?: boolean;

/** Additional classes. */
className?: string;

Expand Down Expand Up @@ -66,8 +69,8 @@ export interface ImageProps {
/** Shorthand for Label. */
label?: SemanticShorthandItem<LabelProps>;

/** An image may appear rounded or circular. */
shape?: 'rounded'|'circular';
/** An image may appear rounded. */
rounded?: boolean;

/** An image may appear at different sizes. */
size?: SemanticSIZES;
Expand Down
13 changes: 9 additions & 4 deletions src/elements/Image/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function Image(props) {
bordered,
centered,
children,
circular,
className,
content,
dimmer,
Expand All @@ -43,7 +44,7 @@ function Image(props) {
href,
inline,
label,
shape,
rounded,
size,
spaced,
src,
Expand All @@ -56,14 +57,15 @@ function Image(props) {
const classes = cx(
useKeyOnly(ui, 'ui'),
size,
shape,
useKeyOnly(avatar, 'avatar'),
useKeyOnly(bordered, 'bordered'),
useKeyOnly(circular, 'circular'),
useKeyOnly(centered, 'centered'),
useKeyOnly(disabled, 'disabled'),
useKeyOnly(fluid, 'fluid'),
useKeyOnly(hidden, 'hidden'),
useKeyOnly(inline, 'inline'),
useKeyOnly(rounded, 'rounded'),
useKeyOrValueAndKey(spaced, 'spaced'),
useValueAndKey(floated, 'floated'),
useVerticalAlignProp(verticalAlign, 'aligned'),
Expand Down Expand Up @@ -122,6 +124,9 @@ Image.propTypes = {
/** Primary content. */
children: PropTypes.node,

/** An image may appear circular. */
circular: PropTypes.bool,

/** Additional classes. */
className: PropTypes.string,

Expand Down Expand Up @@ -161,8 +166,8 @@ Image.propTypes = {
/** Shorthand for Label. */
label: customPropTypes.itemShorthand,

/** An image may appear rounded or circular. */
shape: PropTypes.oneOf(['rounded', 'circular']),
/** An image may appear rounded. */
rounded: PropTypes.bool,

/** An image may appear at different sizes. */
size: PropTypes.oneOf(SUI.SIZES),
Expand Down
3 changes: 2 additions & 1 deletion test/specs/elements/Image/Image-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ describe('Image', () => {
common.propKeyOnlyToClassName(Image, 'avatar')
common.propKeyOnlyToClassName(Image, 'bordered')
common.propKeyOnlyToClassName(Image, 'centered')
common.propKeyOnlyToClassName(Image, 'circular')
common.propKeyOnlyToClassName(Image, 'disabled')
common.propKeyOnlyToClassName(Image, 'fluid')
common.propKeyOnlyToClassName(Image, 'hidden')
common.propKeyOnlyToClassName(Image, 'inline')
common.propKeyOnlyToClassName(Image, 'rounded')

common.propKeyOrValueAndKeyToClassName(Image, 'spaced', ['left', 'right'])

common.propValueOnlyToClassName(Image, 'shape', ['rounded', 'circular'])
common.propValueOnlyToClassName(Image, 'size', SUI.SIZES)

it('renders an img tag', () => {
Expand Down