Skip to content

Commit

Permalink
Merge pull request #10 from andela/ft-icon-component-167621408
Browse files Browse the repository at this point in the history
#167621408 Create reusable icon component
  • Loading branch information
nedemenang committed Aug 2, 2019
2 parents 496f6e2 + 4be2af6 commit 135ed14
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 0 deletions.
Binary file added src/assets/images/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions src/assets/images/twitter-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions src/assets/images/twitter-normal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/components/IconComponent/IconComponent.spec.js
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'}
/>
);
});
});
26 changes: 26 additions & 0 deletions src/components/IconComponent/index.jsx
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;
9 changes: 9 additions & 0 deletions src/components/IconComponent/index.scss
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;
}

0 comments on commit 135ed14

Please sign in to comment.