-
Notifications
You must be signed in to change notification settings - Fork 4k
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
style(Checkbox|Flag|Image|Radio): propTypes cleanups and typings update #1155
Changes from 1 commit
5652ee5
e28f64f
f99f555
2646d2d
358cadc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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. | ||
**/ | ||
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. Added description 😄 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. The closing tag for a doc block only needs one asterisk: /**
* ...
*/ 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. Also updated other doc blocks. |
||
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 | ||
|
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>; |
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.
😄