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

Flag: update rest props and propTypes #359

Merged
merged 1 commit into from
Aug 2, 2016
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
25 changes: 12 additions & 13 deletions src/elements/Flag/Flag.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import React, { PropTypes } from 'react'
import cx from 'classnames'
import META from '../../utils/Meta'

function Flag(props) {
const { className, name, ...rest } = props
const classes = cx(
name,
className,
'flag',
)
import React, { PropTypes } from 'react'

return <i className={classes} {...rest} />
}
import META from '../../utils/Meta'
import { getUnhandledProps } from '../../utils/propUtils'

const names = [
'ad', 'andorra', 'ae', 'united arab emirates', 'uae', 'af', 'afghanistan', 'ag', 'antigua', 'ai', 'anguilla', 'al',
Expand Down Expand Up @@ -57,6 +48,14 @@ const names = [
'ye', 'yemen', 'yt', 'mayotte', 'za', 'south africa', 'zm', 'zambia', 'zw', 'zimbabwe',
]

function Flag(props) {
const { className, name } = props
const rest = getUnhandledProps(Flag, props)
const classes = cx(name, className, 'flag')

return <i className={classes} {...rest} />
}

Flag._meta = {
library: META.library.semanticUI,
name: 'Flag',
Expand All @@ -71,7 +70,7 @@ Flag.propTypes = {
className: PropTypes.string,

/** Flag name, can use the two digit country code, the full name, or a common alias */
name: PropTypes.oneOf(names).isRequired,
name: PropTypes.oneOf(Flag._meta.props.name).isRequired,
}

export default Flag
Expand Down
1 change: 0 additions & 1 deletion src/utils/semanticUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,3 @@ export const icons = [
...accessibilityIcons,
...brandsIcons,
]