-
Notifications
You must be signed in to change notification settings - Fork 4
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 #10 from andela/ft-icon-component-167621408
#167621408 Create reusable icon component
- Loading branch information
Showing
6 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import IconComponent from './index.jsx'; | ||
|
||
describe('Render component', () => { | ||
it('renders Icon component', () => { | ||
shallow( | ||
<IconComponent | ||
src={'./../src/assets/images/twitter-normal.svg'} | ||
alt={'image asset'} | ||
className={'icon-small'} | ||
/> | ||
); | ||
}); | ||
}); |
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,26 @@ | ||
import React from 'react'; | ||
import PropTypes from 'proptypes'; | ||
import './index.scss'; | ||
|
||
|
||
/** | ||
* Sample Usage | ||
* <IconComponent | ||
* src={'./../src/assets/images/twitter-dark.svg'} | ||
* alt={'image asset'} | ||
* className={'icon-large'} | ||
* /> | ||
*/ | ||
const IconComponent = ({ className, src, alt }) => { | ||
return <img className={className} src={src} alt={alt} />; | ||
}; | ||
|
||
|
||
|
||
IconComponent.propTypes = { | ||
className: PropTypes.string.isRequired, | ||
src: PropTypes.string.isRequired, | ||
alt: PropTypes.string.isRequired | ||
}; | ||
|
||
export default IconComponent; |
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,9 @@ | ||
.icon-large { | ||
height: 100px; | ||
width: 100px; | ||
} | ||
|
||
.icon-small { | ||
height: 20px; | ||
width: 20px; | ||
} |