Skip to content

Commit

Permalink
feat(icon): Add name convention for size prop
Browse files Browse the repository at this point in the history
  • Loading branch information
lzcabrera committed Sep 21, 2017
1 parent 561c0d5 commit c3f796e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/components/Icon/Icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Icon = ({ glyph, variant, fixedWidth, size, className, children, ...rest }
`${styles[`iconCore${capitalize(glyph)}`]}`,
`${variant ? styles[variant] : ''}`,
`${fixedWidth ? `${styles.fw}` : ''}`,
`${size ? `${styles[size]}` : ''}`,
`${size ? `${styles[`size${size}`]}` : ''}`,
`${className ? `${className}` : ''}`
].join(' ')

Expand Down Expand Up @@ -85,7 +85,7 @@ Icon.propTypes = {
/**
*
*/
size: PropTypes.oneOf(['small', 'medium', 'large']),
size: PropTypes.oneOf(['16px', '24px', '48px']),
/**
* One or more CSS class names separated by spaces to append onto the icon.
* Don't advertise as we plan on removing this feature soon.
Expand All @@ -101,7 +101,7 @@ Icon.propTypes = {
Icon.defaultProps = {
variant: 'inherit',
fixedWidth: false,
size: 'medium',
size: '24px',
className: '',
children: null
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Icon/Icon.modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ $core-icon-codepoints: (
text-align: center;
}

.small {
.size16px {
font-size: 1 rem;
}

.medium {
.size24px {
font-size: 1.5rem;
}

.large {
.size48px {
font-size: 3rem;
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/Icon/__tests__/Icon.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ describe('<Icon />', () => {
})

it('can be sized', () => {
const icon = doShallow({ size: 'small' })
const icon = doShallow({ size: '16px' })

expect(icon).toHaveClassName('small')
expect(icon).toHaveClassName('size16px')
})

it('supports custom CSS classes', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
exports[`<Icon /> renders 1`] = `
<i
aria-hidden="true"
className="icon iconCoreCheckmark inherit medium "
className="icon iconCoreCheckmark inherit size24px "
/>
`;

0 comments on commit c3f796e

Please sign in to comment.