2020-09-15 15:01:07 +02:00
|
|
|
const styled = require('styled-components').default;
|
|
|
|
const { css } = require('styled-components');
|
|
|
|
|
|
|
|
interface RootProps {
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2020-09-15 15:01:07 +02:00
|
|
|
readonly theme: any;
|
|
|
|
readonly disabled: boolean;
|
|
|
|
readonly hasTitle: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const StyledRoot = styled.a<RootProps>`
|
2020-11-12 21:13:28 +02:00
|
|
|
opacity: ${(props: RootProps) => props.disabled ? 0.3 : 1};
|
|
|
|
height: ${(props: RootProps) => props.theme.toolbarHeight}px;
|
|
|
|
min-height: ${(props: RootProps) => props.theme.toolbarHeight}px;
|
|
|
|
width: ${(props: RootProps) => props.hasTitle ? 'auto' : `${props.theme.toolbarHeight}px`};
|
|
|
|
max-width: ${(props: RootProps) => props.hasTitle ? 'auto' : `${props.theme.toolbarHeight}px`};
|
2020-09-15 15:01:07 +02:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
cursor: default;
|
|
|
|
border-radius: 3px;
|
|
|
|
box-sizing: border-box;
|
2020-11-12 21:13:28 +02:00
|
|
|
color: ${(props: RootProps) => props.theme.color3};
|
|
|
|
font-size: ${(props: RootProps) => props.theme.toolbarIconSize * 0.8}px;
|
2020-11-08 03:08:33 +02:00
|
|
|
padding-left: 5px;
|
|
|
|
padding-right: 5px;
|
2024-03-04 12:33:39 +02:00
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2020-09-15 15:01:07 +02:00
|
|
|
|
|
|
|
&:hover {
|
2020-11-12 21:13:28 +02:00
|
|
|
background-color: ${(props: RootProps) => props.disabled ? 'none' : props.theme.backgroundColorHover3};
|
2020-09-15 15:01:07 +02:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
interface IconProps {
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2020-09-15 15:01:07 +02:00
|
|
|
readonly theme: any;
|
|
|
|
readonly title: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const iconStyle = css<IconProps>`
|
2020-11-12 21:13:28 +02:00
|
|
|
font-size: ${(props: IconProps) => props.theme.toolbarIconSize}px;
|
|
|
|
color: ${(props: IconProps) => props.theme.color3};
|
|
|
|
margin-right: ${(props: IconProps) => props.title ? 5 : 0}px;
|
2020-11-08 03:23:12 +02:00
|
|
|
pointer-events: none; /* Need this to get button tooltip to work */
|
2020-09-15 15:01:07 +02:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const StyledIconI = styled.i`${iconStyle}`;
|
|
|
|
export const StyledIconSpan = styled.span`${iconStyle}`;
|