Skip to content

Commit

Permalink
feat(components/base): create <Icon />
Browse files Browse the repository at this point in the history
  • Loading branch information
aneurysmjs committed Apr 29, 2019
1 parent 8965ff1 commit af63efe
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 99 deletions.
Binary file added src/app/assets/svg/.DS_Store
Binary file not shown.
Binary file added src/app/assets/svg/icons/.DS_Store
Binary file not shown.
48 changes: 48 additions & 0 deletions src/app/assets/svg/icons/cart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 0 additions & 33 deletions src/app/components/Heading/Heading.js

This file was deleted.

66 changes: 0 additions & 66 deletions src/app/components/Heading/Heading.scss

This file was deleted.

19 changes: 19 additions & 0 deletions src/app/components/base/Icon/Icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// @flow strict
import React from 'react';

import './Icon.scss';

type PropsType = {
name: string,
selected?: string,
};

const Icon = ({ name, selected }: PropsType) => (
<imgx
alt="icon"
className="icon"
src={`assets/svg/icons/${name}${selected ? '-selected' : ''}.svg`}
/>
);

export default Icon;
7 changes: 7 additions & 0 deletions src/app/components/base/Icon/Icon.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import '~styles/functions/px-to-rem';
@import '~styles/mixins';
@import '~styles/variables';

.icon {

}
15 changes: 15 additions & 0 deletions src/app/components/base/Icon/Icon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @flow strict
import React from 'react';
import { shallow } from 'enzyme';

import Icon from './Icon';

describe('Icon', () => {
// const defaultProps = {};

it('should have "name" and "selected" equal to undefined', () => {
const wrap = shallow(<Icon />);
expect(wrap.prop('name')).toEqual(undefined);
expect(wrap.prop('selected')).toEqual(undefined);
});
});

0 comments on commit af63efe

Please sign in to comment.