1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00
joplin/packages/app-desktop/gui/ToolbarButton/styles/index.ts

51 lines
1.8 KiB
TypeScript
Raw Normal View History

2020-09-15 15:01:07 +02:00
const styled = require('styled-components').default;
const { css } = require('styled-components');
interface RootProps {
// 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>`
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;
color: ${(props: RootProps) => props.theme.color3};
font-size: ${(props: RootProps) => props.theme.toolbarIconSize * 0.8}px;
padding-left: 5px;
padding-right: 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
2020-09-15 15:01:07 +02:00
&:hover {
background-color: ${(props: RootProps) => props.disabled ? 'none' : props.theme.backgroundColorHover3};
2020-09-15 15:01:07 +02:00
}
`;
interface IconProps {
// 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>`
font-size: ${(props: IconProps) => props.theme.toolbarIconSize}px;
color: ${(props: IconProps) => props.theme.color3};
margin-right: ${(props: IconProps) => props.title ? 5 : 0}px;
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}`;