-
Notifications
You must be signed in to change notification settings - Fork 4.1k
style(Checkbox|Flag|Image|Radio): propTypes cleanups and typings update #1155
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5652ee5
style(Checkbox|Flag|Image|Radio): propTypes cleanups
e28f64f
chore(commonTest): remove obsolete assertions
f99f555
fix(EmbedTest): fix lint issue
2646d2d
test(commonTest): update commonTests
358cadc
style(EmbedTest): fix lint issue
layershifter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
import { CheckboxProps } from '../../modules/Checkbox/index'; | ||
import * as React from 'react'; | ||
|
||
export const Radio: React.ComponentClass<CheckboxProps>; | ||
interface RadioProps { | ||
[key: string]: any; | ||
|
||
/** Format to emphasize the current selection state. */ | ||
slider?: boolean; | ||
|
||
/** Format to show an on or off choice. */ | ||
toggle?: boolean; | ||
|
||
/** HTML input type, either checkbox or radio. */ | ||
type?: 'checkbox' | 'radio'; | ||
} | ||
|
||
export const Radio: React.StatelessComponent<RadioProps>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New typings for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,9 +53,12 @@ const names = [ | |
'ye', 'yemen', 'yt', 'mayotte', 'za', 'south africa', 'zm', 'zambia', 'zw', 'zimbabwe', | ||
] | ||
|
||
/** | ||
* A flag is is used to represent a political state. | ||
*/ | ||
function Flag(props) { | ||
const { className, name } = props | ||
const classes = cx(name, className, 'flag') | ||
const classes = cx(name, 'flag', className) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const rest = getUnhandledProps(Flag, props) | ||
const ElementType = getElementType(Flag, props) | ||
|
||
|
@@ -65,9 +68,6 @@ function Flag(props) { | |
Flag._meta = { | ||
name: 'Flag', | ||
type: META.TYPES.ELEMENT, | ||
props: { | ||
name: names, | ||
}, | ||
} | ||
|
||
Flag.propTypes = { | ||
|
@@ -77,8 +77,8 @@ Flag.propTypes = { | |
/** Additional classes. */ | ||
className: PropTypes.string, | ||
|
||
/** Flag name, can use the two digit country code, the full name, or a common alias */ | ||
name: customPropTypes.suggest(Flag._meta.props.name), | ||
/** Flag name, can use the two digit country code, the full name, or a common alias. */ | ||
name: customPropTypes.suggest(names), | ||
} | ||
|
||
Flag.defaultProps = { | ||
|
@@ -88,4 +88,3 @@ Flag.defaultProps = { | |
Flag.create = createShorthandFactory(Flag, value => ({ name: value })) | ||
|
||
export default Flag | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
import { ReactMouseEvents, SemanticCOUNTRY } from '../..'; | ||
import * as React from 'react'; | ||
import { SemanticCOUNTRY } from '../..'; | ||
|
||
// Flag | ||
// ---------------------------------- | ||
interface FlagProps extends ReactMouseEvents<any> { | ||
interface FlagProps { | ||
[key: string]: any; | ||
|
||
/** An element type to render as (string or function). */ | ||
as?: any; | ||
|
||
/** Additional classes. */ | ||
className?: string; | ||
|
||
/** Flag name, can use the two digit country code, the full name, or a common alias */ | ||
/** Flag name, can use the two digit country code, the full name, or a common alias. */ | ||
name: SemanticCOUNTRY, | ||
} | ||
|
||
export class Flag extends React.Component<FlagProps, void> { | ||
} | ||
export const Flag : React.StatelessComponent<FlagProps>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Dots 😄
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.
😄