-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add Flag component #322
Add Flag component #322
Conversation
Fixes #177 |
Current coverage is 89.01%
|
'flag', | ||
) | ||
|
||
return (<i className={classes} {...rest} />) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parens are only required for multi line JSX. They can be removed here.
Looks good to me 👍 Let's add the flag names, ISO codes, and aliases in the prop validation for |
Do you mean something like this? const names = [
'andorra',
'ad',
...,
'burma',
'mm',
'myanmar'
];
Flag._meta = {
props: {
name: names
}
}
Flag.propTypes = {
size: PropTypes.oneOf(Flag._meta.props.name)
} |
Yep, that will do it. As far as syntax, you can list them out horizontally since there will be many. We allow 120 columns per line. |
Great, lmk if there is anything else you'd like to do here. Otherwise, I'll merge this once tests pass. |
Oh, almost forgot. Go ahead and check it off in the README.md under support :) |
Updated branch and README 😄 |
.should.have.tagName('i') | ||
}) | ||
|
||
it('passes property "name" to class', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this earlier, this test should be replaced with the common tests for "value only" props:
common.propValueOnlyToClassName(Flag, 'name')
This test ensures the prop is defined in _meta, is added to className when it should be, and is not added when it shouldn't be.
Thanks for the component! |
* Flag component * Flag component Semantic-Org#322 * README.md update Semantic-Org#322 * Flag Component test update Semantic-Org#321
API discussion
This component is pretty simple. There is only one changable property. I propose use
name
property as inIcon
#279.Feedback welcome 😄