Skip to content

Commit 753d0e2

Browse files
authored
feat(icons): add new shield Icon (#1216)
BREAKING CHANGE: Replacing IconShield with a new Icon that represent Shield. It follows the the 32 x 32 guideline. Please override any style if needed.
1 parent 9e91115 commit 753d0e2

File tree

3 files changed

+95
-9
lines changed

3 files changed

+95
-9
lines changed

src/icons/general/IconShield.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,46 @@
11
// @flow
22
import * as React from 'react';
33

4+
import classNames from 'classnames';
45
import AccessibleSVG from '../accessible-svg';
6+
import { boxBlue, white } from '../../styles/variables';
57

68
type Props = {
79
className?: string,
810
color?: string,
911
height?: number,
12+
opacity?: number,
1013
/** A text-only string describing the icon if it's not purely decorative for accessibility */
1114
title?: string | React.Element<any>,
1215
width?: number,
1316
};
1417

15-
const IconShield = ({ className = '', color = '#888888', height = 14, title, width = 12 }: Props) => (
18+
const IconShield = ({ className, color = boxBlue, height = 32, opacity = 0.2, width = 32, title }: Props) => (
1619
<AccessibleSVG
17-
className={`icon-governance ${className}`}
20+
className={classNames('bdl-IconShield', className)}
1821
height={height}
1922
title={title}
20-
viewBox="0 0 12 14"
23+
viewBox="0 0 32 32"
2124
width={width}
2225
>
23-
<g
26+
<path
2427
className="stroke-color"
25-
fill="none"
26-
fillRule="evenodd"
28+
fill={white}
2729
stroke={color}
2830
strokeLinecap="round"
2931
strokeLinejoin="round"
30-
>
31-
<path d="M.5 1.5S3.25 3.08 6 .5c2.75 2.58 5.5 1 5.5 1v8.88L6 13.5.5 10.37V1.5zM9.5 4.5v4" />
32-
</g>
32+
strokeWidth="2"
33+
d="M3 3.308S9.5 6.962 16 1c6.5 5.962 13 2.308 13 2.308v20.48L16 31 3 23.788V3.308z"
34+
/>
35+
<path className="fill-color" fill={color} fillOpacity={opacity} d="M16 5C10.5 8.5 6 7 6 7v14.712L16 27V5z" />
36+
<path
37+
className="stroke-color"
38+
stroke={color}
39+
strokeLinecap="round"
40+
strokeLinejoin="round"
41+
strokeWidth="2"
42+
d="M25 10v11"
43+
/>
3344
</AccessibleSVG>
3445
);
3546

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// @flow
2+
import React from 'react';
3+
4+
import IconShield from '../IconShield';
5+
6+
describe('icons/states/IconShield', () => {
7+
test('should correctly render default icon', () => {
8+
const wrapper = shallow(<IconShield />);
9+
expect(wrapper.hasClass('bdl-IconShield')).toBeTruthy();
10+
});
11+
12+
test('should correctly render the icon with specified class', () => {
13+
const className = 'my-state';
14+
const wrapper = shallow(<IconShield className={className} />);
15+
16+
expect(wrapper.hasClass(className)).toBeTruthy();
17+
});
18+
19+
test('should correctly render icon with specified width and height', () => {
20+
const width = 20;
21+
const height = 15;
22+
const wrapper = shallow(<IconShield height={height} width={width} />);
23+
24+
expect(wrapper.prop('width')).toEqual(width);
25+
expect(wrapper.prop('height')).toEqual(height);
26+
});
27+
28+
test('should correctly render svg with specified title', () => {
29+
const title = 'oh what ever';
30+
const wrapper = shallow(<IconShield title={title} />);
31+
32+
expect(wrapper.prop('title')).toEqual(title);
33+
});
34+
35+
test('should override color in svg when specified', () => {
36+
const color = '#bdf';
37+
const wrapper = shallow(<IconShield color={color} />);
38+
39+
expect(wrapper).toMatchSnapshot();
40+
});
41+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`icons/states/IconShield should override color in svg when specified 1`] = `
4+
<AccessibleSVG
5+
className="bdl-IconShield"
6+
height={32}
7+
viewBox="0 0 32 32"
8+
width={32}
9+
>
10+
<path
11+
className="stroke-color"
12+
d="M3 3.308S9.5 6.962 16 1c6.5 5.962 13 2.308 13 2.308v20.48L16 31 3 23.788V3.308z"
13+
fill="#fff"
14+
stroke="#bdf"
15+
strokeLinecap="round"
16+
strokeLinejoin="round"
17+
strokeWidth="2"
18+
/>
19+
<path
20+
className="fill-color"
21+
d="M16 5C10.5 8.5 6 7 6 7v14.712L16 27V5z"
22+
fill="#bdf"
23+
fillOpacity={0.2}
24+
/>
25+
<path
26+
className="stroke-color"
27+
d="M25 10v11"
28+
stroke="#bdf"
29+
strokeLinecap="round"
30+
strokeLinejoin="round"
31+
strokeWidth="2"
32+
/>
33+
</AccessibleSVG>
34+
`;

0 commit comments

Comments
 (0)