-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from iCHEF/release/3.0.0
Release 3.0.0
- Loading branch information
Showing
46 changed files
with
1,265 additions
and
620 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
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,46 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
import './styles/Avatar.scss'; | ||
|
||
import icBEM from './utils/icBEM'; | ||
import prefixClass from './utils/prefixClass'; | ||
|
||
const COMPONENT_NAME = prefixClass('avatar'); | ||
const ROOT_BEM = icBEM(COMPONENT_NAME); | ||
|
||
const SQUARE = 'square'; | ||
const ROUNDED = 'rounded'; | ||
const CIRCLE = 'circle'; | ||
export const AVATAR_TYPE = { SQUARE, ROUNDED, CIRCLE }; | ||
|
||
function Avatar({ | ||
className, | ||
src, | ||
alt, | ||
type, | ||
...otherProps | ||
}) { | ||
const bemClass = ROOT_BEM.modifier(type); | ||
|
||
const rootClassName = classNames(className, `${bemClass}`); | ||
|
||
return ( | ||
<div className={rootClassName} {...otherProps}> | ||
<img alt={alt} src={src} /> | ||
</div> | ||
); | ||
} | ||
|
||
Avatar.propTypes = { | ||
src: PropTypes.string.isRequired, | ||
alt: PropTypes.string.isRequired, | ||
type: PropTypes.oneOf(Object.values(AVATAR_TYPE)), | ||
}; | ||
|
||
Avatar.defaultProps = { | ||
type: SQUARE, | ||
}; | ||
|
||
export default Avatar; |
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
Oops, something went wrong.