Skip to content

Commit 0115fb6

Browse files
indiramurumergify[bot]
authored andcommitted
feat(icon): create login and storage icon (#1708)
* feat(icon): create login and storage icon * feat(icon): address review comments * feat(icon): Fix typo
1 parent 17a7966 commit 0115fb6

File tree

6 files changed

+165
-0
lines changed

6 files changed

+165
-0
lines changed

src/icons/general/IconLogin.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// @flow
2+
import * as React from 'react';
3+
4+
import AccessibleSVG from '../accessible-svg';
5+
import { bdlGray80 } from '../../styles/variables';
6+
7+
type Props = {
8+
className?: string,
9+
color?: string,
10+
height?: number,
11+
/** A text-only string describing the icon if it's not purely decorative for accessibility */
12+
title?: string | React.Element<any>,
13+
width?: number,
14+
};
15+
16+
const IconLogin = ({ className = '', color = bdlGray80, height = 16, title, width = 16 }: Props) => (
17+
<AccessibleSVG
18+
className={`bdl-IconLogin ${className}`}
19+
height={height}
20+
title={title}
21+
viewBox="0 0 16 16"
22+
width={width}
23+
>
24+
<path
25+
className="fill-color"
26+
fill={color}
27+
d="M12,3H4C3.4,3,3,3.4,3,4v8c0,0.6,0.4,1,1,1h8c0.6,0,1-0.4,1-1V4C13,3.4,12.6,3,12,3z M12,2c1.1,0,2,0.9,2,2v8c0,1.1-0.9,2-2,2H4c-1.1,0-2-0.9-2-2V4c0-1.1,0.9-2,2-2H12z M8.1,3.9l4.2,4.2l-4.2,4.2l-0.7-0.7l3-3l-6.6,0v-1l6.6,0l-3-3L8.1,3.9z"
28+
/>
29+
</AccessibleSVG>
30+
);
31+
32+
export default IconLogin;

src/icons/general/IconLogin.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```js
2+
<IconLogin />
3+
```

src/icons/general/IconStorage.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// @flow
2+
import * as React from 'react';
3+
4+
import AccessibleSVG from '../accessible-svg';
5+
import { bdlGreenLight } from '../../styles/variables';
6+
7+
type Props = {
8+
className?: string,
9+
color?: string,
10+
height?: number,
11+
title?: string,
12+
width?: number,
13+
};
14+
15+
const IconStorage = ({ className = '', color = bdlGreenLight, height = 12, title, width = 16 }: Props) => (
16+
<AccessibleSVG
17+
className={`bdl-IconStorage ${className}`}
18+
height={height}
19+
title={title}
20+
viewBox="0 0 16 12"
21+
width={width}
22+
>
23+
<rect
24+
className="background-color"
25+
clipRule="evenodd"
26+
fill="#D8D8D8"
27+
fillOpacity="0"
28+
fillRule="evenodd"
29+
height="16"
30+
width="16"
31+
y="-2"
32+
/>
33+
<path
34+
className="fill-color"
35+
d="M12,1c0-0.6,0.4-1,1-1h2c0.6,0,1,0.4,1,1v10c0,0.6-0.4,1-1,1h-2c-0.6,0-1-0.4-1-1V1z M6,3c0-0.6,0.4-1,1-1h2c0.6,0,1,0.4,1,1v8c0,0.6-0.4,1-1,1H7c-0.6,0-1-0.4-1-1V3z M0,7c0-0.6,0.4-1,1-1h2c0.6,0,1,0.4,1,1v4c0,0.6-0.4,1-1,1H1c-0.6,0-1-0.4-1-1V7z"
36+
fill={color}
37+
/>
38+
</AccessibleSVG>
39+
);
40+
41+
export default IconStorage;

src/icons/general/IconStorage.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```js
2+
<IconStorage />
3+
```
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
import IconLogin from '../IconLogin';
3+
4+
describe('icons/general/IconLogin', () => {
5+
test('should correctly render default icon', () => {
6+
const wrapper = shallow(<IconLogin />);
7+
8+
expect(wrapper.is('AccessibleSVG')).toBe(true);
9+
expect(wrapper.prop('height')).toEqual(16);
10+
expect(wrapper.prop('width')).toEqual(16);
11+
expect(wrapper.find('path').prop('fill')).toEqual('#4e4e4e');
12+
});
13+
14+
test('should correctly render icon with specified class', () => {
15+
const wrapper = shallow(<IconLogin className="test" />);
16+
17+
expect(wrapper.hasClass('bdl-IconLogin')).toBe(true);
18+
expect(wrapper.hasClass('test')).toBe(true);
19+
});
20+
21+
test('should correctly render icon with specified color', () => {
22+
const color = 'green';
23+
const wrapper = shallow(<IconLogin color={color} />);
24+
25+
expect(wrapper.find('path').prop('fill')).toEqual(color);
26+
});
27+
28+
test('should correctly render icon with specified width and height', () => {
29+
const width = 16;
30+
const height = 17;
31+
const wrapper = shallow(<IconLogin height={height} width={width} />);
32+
33+
expect(wrapper.find('AccessibleSVG').prop('width')).toEqual(width);
34+
expect(wrapper.find('AccessibleSVG').prop('height')).toEqual(height);
35+
});
36+
37+
test('should correctly render icon with title', () => {
38+
const title = 'hello';
39+
const wrapper = shallow(<IconLogin title={title} />);
40+
41+
expect(wrapper.find('AccessibleSVG').prop('title')).toEqual(title);
42+
});
43+
});
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
import IconStorage from '../IconStorage';
3+
4+
describe('icons/general/IconStorage', () => {
5+
test('should correctly render default icon', () => {
6+
const wrapper = shallow(<IconStorage />);
7+
8+
expect(wrapper.is('AccessibleSVG')).toBe(true);
9+
expect(wrapper.prop('height')).toEqual(12);
10+
expect(wrapper.prop('width')).toEqual(16);
11+
expect(wrapper.find('path').prop('fill')).toEqual('#26c281');
12+
});
13+
14+
test('should correctly render icon with specified class', () => {
15+
const wrapper = shallow(<IconStorage className="test" />);
16+
17+
expect(wrapper.hasClass('bdl-IconStorage')).toBe(true);
18+
expect(wrapper.hasClass('test')).toBe(true);
19+
});
20+
21+
test('should correctly render icon with specified color', () => {
22+
const color = 'green';
23+
const wrapper = shallow(<IconStorage color={color} />);
24+
25+
expect(wrapper.find('path').prop('fill')).toEqual(color);
26+
});
27+
28+
test('should correctly render icon with specified width and height', () => {
29+
const width = 16;
30+
const height = 17;
31+
const wrapper = shallow(<IconStorage height={height} width={width} />);
32+
33+
expect(wrapper.find('AccessibleSVG').prop('width')).toEqual(width);
34+
expect(wrapper.find('AccessibleSVG').prop('height')).toEqual(height);
35+
});
36+
37+
test('should correctly render icon with title', () => {
38+
const title = 'hello';
39+
const wrapper = shallow(<IconStorage title={title} />);
40+
41+
expect(wrapper.find('AccessibleSVG').prop('title')).toEqual(title);
42+
});
43+
});

0 commit comments

Comments
 (0)