Co-authored-by: devrk96 <rohit.kumawat@primathon.in> Co-authored-by: hetunandu <hetu@appsmith.com> Co-authored-by: Hetu Nandu <hetunandu@gmail.com> Co-authored-by: Vicky Bansal <67091118+vicky-primathon@users.noreply.github.com> Co-authored-by: nandan.anantharamu <nandan.anantharamu@thoughtspot.com>
40 lines
926 B
TypeScript
40 lines
926 B
TypeScript
import styled from "styled-components";
|
|
import { Color } from "./Colors";
|
|
|
|
export type IconProps = {
|
|
width?: number;
|
|
height?: number;
|
|
color?: Color;
|
|
background?: Color;
|
|
onClick?: (e?: any) => void;
|
|
className?: string;
|
|
keepColors?: boolean;
|
|
};
|
|
|
|
export const IconWrapper = styled.div<IconProps>`
|
|
&:focus {
|
|
outline: none;
|
|
}
|
|
display: inline-block;
|
|
width: ${(props) => props.width}px;
|
|
height: ${(props) => props.height}px;
|
|
&& svg {
|
|
width: ${(props) => props.width || props.theme.fontSizes[6]}px;
|
|
height: ${(props) => props.height || props.theme.fontSizes[6]}px;
|
|
|
|
${(props) =>
|
|
!props.keepColors
|
|
? `
|
|
path {
|
|
fill: ${props.color || props.theme.colors.textOnDarkBG};
|
|
}
|
|
circle {
|
|
fill: ${props.background || props.theme.colors.paneBG};
|
|
}
|
|
rect {
|
|
fill: ${props.background || props.theme.colors.propertyPane.jsIconBg};
|
|
}`
|
|
: ""}
|
|
}
|
|
`;
|