forked from openedx/paragon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: release chip, searchfield, pagination, form.autosuggest (opene…
- Loading branch information
1 parent
613bed0
commit 0274f10
Showing
47 changed files
with
2,488 additions
and
1,476 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { KeyboardEventHandler, MouseEventHandler } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Icon from '../Icon'; | ||
// @ts-ignore | ||
import IconButton from '../IconButton'; | ||
// @ts-ignore | ||
import { STYLE_VARIANTS } from './constants'; | ||
|
||
export interface ChipIconProps { | ||
className: string, | ||
src: React.ReactElement | Function, | ||
onClick?: KeyboardEventHandler & MouseEventHandler, | ||
alt?: string, | ||
variant: string, | ||
disabled?: boolean, | ||
} | ||
|
||
function ChipIcon({ | ||
className, src, onClick, alt, variant, disabled, | ||
}: ChipIconProps) { | ||
if (onClick) { | ||
return ( | ||
<IconButton | ||
className={className} | ||
src={src} | ||
onClick={onClick} | ||
iconAs={Icon} | ||
alt={alt} | ||
invertColors={variant === STYLE_VARIANTS.DARK} | ||
tabIndex={disabled ? -1 : 0} | ||
/> | ||
); | ||
} | ||
|
||
return <Icon src={src} className={className} size="sm" />; | ||
} | ||
|
||
ChipIcon.propTypes = { | ||
className: PropTypes.string.isRequired, | ||
src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired, | ||
onClick: PropTypes.func, | ||
alt: PropTypes.string, | ||
variant: PropTypes.string, | ||
disabled: PropTypes.bool, | ||
}; | ||
|
||
ChipIcon.defaultProps = { | ||
onClick: undefined, | ||
alt: undefined, | ||
variant: STYLE_VARIANTS.LIGHT, | ||
disabled: false, | ||
}; | ||
|
||
export default ChipIcon; |
This file contains 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.