-
Notifications
You must be signed in to change notification settings - Fork 209
/
AccentIcon.tsx
44 lines (39 loc) · 1.09 KB
/
AccentIcon.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as React from 'react';
import {colors} from '@workday/canvas-kit-react-core';
import {CanvasAccentIcon, CanvasIconTypes} from '@workday/design-assets-types';
import {CSSObject} from '@emotion/core';
import Icon from './Icon';
import {SpanProps} from './types';
export interface AccentIconStyles {
color?: string;
transparent?: boolean;
}
export interface AccentIconProps extends AccentIconStyles {
icon: CanvasAccentIcon;
size?: number;
}
export const accentIconStyles = ({
color = colors.blueberry500,
transparent = false,
}: AccentIconStyles): CSSObject => ({
'& .color-500': {
fill: color,
},
'& .french-vanilla-100': {
fill: transparent ? 'transparent' : colors.frenchVanilla100,
},
});
export default class AccentIcon extends React.Component<SpanProps & AccentIconProps> {
render() {
const {icon, color, transparent, size, ...elemProps} = this.props;
return (
<Icon
src={icon}
type={CanvasIconTypes.Accent}
styles={accentIconStyles({color, transparent})}
size={size}
elemProps={elemProps}
/>
);
}
}