Skip to content

Commit 8eb68b3

Browse files
feixuanlimergify[bot]
authored andcommitted
feat(classification): change icon for classify/classification action (#1520)
1 parent 55dd287 commit 8eb68b3

File tree

8 files changed

+134
-10
lines changed

8 files changed

+134
-10
lines changed

src/features/classification/AddClassificationBadge.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import * as React from 'react';
33
import { FormattedMessage } from 'react-intl';
44

5-
import IconAddTags from '../../icons/general/IconAddTags';
5+
import IconSecurityClassification from '../../icons/general/IconSecurityClassification';
66
import { bdlGray62 } from '../../styles/variables';
77
import messages from './messages';
88
import './AddClassificationBadge.scss';
99

1010
const AddClassificationBadge = () => (
1111
<h1 className="bdl-AddClassificationBadge">
12-
<IconAddTags color={bdlGray62} height={10} width={10} strokeWidth={3} />
12+
<IconSecurityClassification color={bdlGray62} height={10} width={10} />
1313
<FormattedMessage {...messages.addClassification}>
1414
{value => <span className="bdl-AddClassificationBadge-name">{value}</span>}
1515
</FormattedMessage>

src/features/classification/ClassifiedBadge.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import * as React from 'react';
33

44
import Tooltip from '../../components/tooltip';
5-
import IconAddTags from '../../icons/general/IconAddTags';
5+
import IconSecurityClassification from '../../icons/general/IconSecurityClassification';
66
import { bdlYellorange } from '../../styles/variables';
77
import type { Position } from '../../components/tooltip';
88
import './ClassifiedBadge.scss';
@@ -16,7 +16,7 @@ type Props = {
1616
const ClassifiedBadge = ({ name, tooltipPosition = 'bottom-center', tooltipText }: Props) => (
1717
<Tooltip isDisabled={!tooltipText} position={tooltipPosition} text={tooltipText}>
1818
<h1 className="bdl-ClassifiedBadge">
19-
<IconAddTags color={bdlYellorange} height={10} width={10} strokeWidth={3} />
19+
<IconSecurityClassification color={bdlYellorange} height={10} width={10} />
2020
<span className="bdl-ClassifiedBadge-name">{name}</span>
2121
</h1>
2222
</Tooltip>

src/features/classification/__tests__/__snapshots__/AddClassificationBadge-test.js.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ exports[`features/classification/AddClassificationBadge should render a classifi
44
<h1
55
className="bdl-AddClassificationBadge"
66
>
7-
<IconAddTags
7+
<IconSecurityClassification
88
color="#767676"
99
height={10}
10-
strokeWidth={3}
1110
width={10}
1211
/>
1312
<FormattedMessage

src/features/classification/__tests__/__snapshots__/ClassifiedBadge-test.js.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ exports[`features/classification/ClassifiedBadge should render a classified badg
1212
<h1
1313
className="bdl-ClassifiedBadge"
1414
>
15-
<IconAddTags
15+
<IconSecurityClassification
1616
color="#f5b31b"
1717
height={10}
18-
strokeWidth={3}
1918
width={10}
2019
/>
2120
<span
@@ -38,10 +37,9 @@ exports[`features/classification/ClassifiedBadge should render a classified badg
3837
<h1
3938
className="bdl-ClassifiedBadge"
4039
>
41-
<IconAddTags
40+
<IconSecurityClassification
4241
color="#f5b31b"
4342
height={10}
44-
strokeWidth={3}
4543
width={10}
4644
/>
4745
<span
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// @flow
2+
import * as React from 'react';
3+
import classNames from 'classnames';
4+
5+
import AccessibleSVG from '../accessible-svg';
6+
import { bdlGray } from '../../styles/variables';
7+
8+
type Props = {
9+
className?: string,
10+
color?: string,
11+
height?: number,
12+
strokeWidth?: number,
13+
/** A text-only string describing the icon if it's not purely decorative for accessibility */
14+
title?: string | React.Element<any>,
15+
width?: number,
16+
};
17+
18+
const IconSecurityClassification = ({
19+
className = '',
20+
height = 32,
21+
color = bdlGray,
22+
title,
23+
strokeWidth = 2,
24+
width = 32,
25+
}: Props) => {
26+
const classes = classNames('bdl-IconSecurityClassification', className);
27+
28+
return (
29+
<AccessibleSVG className={classes} height={height} title={title} viewBox="0 0 32 32" width={width}>
30+
<path
31+
d="M17,2 L5,8 L5,15 C5,21.4214876 10.6933333,29.5421488 17,31 C23.3066667,29.5421488 29,21.4214876 29,15 L29,8 L17,2 Z"
32+
stroke={color}
33+
strokeWidth={strokeWidth}
34+
fill="none"
35+
/>
36+
<path
37+
d="M23,11 L23,19"
38+
stroke={color}
39+
strokeWidth={strokeWidth}
40+
strokeLinecap="round"
41+
strokeLinejoin="round"
42+
fill="none"
43+
/>
44+
</AccessibleSVG>
45+
);
46+
};
47+
48+
export default IconSecurityClassification;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```js
2+
<IconSecurityClassification />
3+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react';
2+
3+
import IconSecurityClassification from '../IconSecurityClassification';
4+
5+
describe('icons/general/IconSecurityClassification', () => {
6+
const getWrapper = (props = {}) => shallow(<IconSecurityClassification {...props} />);
7+
8+
test('should correctly render icon with default values', () => {
9+
const wrapper = getWrapper();
10+
11+
expect(wrapper).toMatchSnapshot();
12+
});
13+
14+
test('should correctly render icon with all props specified', () => {
15+
const wrapper = getWrapper({
16+
className: 'test',
17+
color: '#987654',
18+
height: 100,
19+
strokeWidth: 1,
20+
title: 'title',
21+
width: 200,
22+
});
23+
24+
expect(wrapper).toMatchSnapshot();
25+
});
26+
});
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`icons/general/IconSecurityClassification should correctly render icon with all props specified 1`] = `
4+
<AccessibleSVG
5+
className="bdl-IconSecurityClassification test"
6+
height={100}
7+
title="title"
8+
viewBox="0 0 32 32"
9+
width={200}
10+
>
11+
<path
12+
d="M17,2 L5,8 L5,15 C5,21.4214876 10.6933333,29.5421488 17,31 C23.3066667,29.5421488 29,21.4214876 29,15 L29,8 L17,2 Z"
13+
fill="none"
14+
stroke="#987654"
15+
strokeWidth={1}
16+
/>
17+
<path
18+
d="M23,11 L23,19"
19+
fill="none"
20+
stroke="#987654"
21+
strokeLinecap="round"
22+
strokeLinejoin="round"
23+
strokeWidth={1}
24+
/>
25+
</AccessibleSVG>
26+
`;
27+
28+
exports[`icons/general/IconSecurityClassification should correctly render icon with default values 1`] = `
29+
<AccessibleSVG
30+
className="bdl-IconSecurityClassification"
31+
height={32}
32+
viewBox="0 0 32 32"
33+
width={32}
34+
>
35+
<path
36+
d="M17,2 L5,8 L5,15 C5,21.4214876 10.6933333,29.5421488 17,31 C23.3066667,29.5421488 29,21.4214876 29,15 L29,8 L17,2 Z"
37+
fill="none"
38+
stroke="#222"
39+
strokeWidth={2}
40+
/>
41+
<path
42+
d="M23,11 L23,19"
43+
fill="none"
44+
stroke="#222"
45+
strokeLinecap="round"
46+
strokeLinejoin="round"
47+
strokeWidth={2}
48+
/>
49+
</AccessibleSVG>
50+
`;

0 commit comments

Comments
 (0)