2020-09-15 15:01:07 +02:00
|
|
|
import { Props, Value } from '../ToggleEditorsButton';
|
2020-11-07 17:59:37 +02:00
|
|
|
const { buildStyle } = require('@joplin/lib/theme');
|
2020-09-15 15:01:07 +02:00
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
export default function styles(props: Props) {
|
2020-09-15 15:01:07 +02:00
|
|
|
return buildStyle(['ToggleEditorsButton', props.value], props.themeId, (theme: any) => {
|
|
|
|
const iconSize = 15;
|
|
|
|
const mdIconWidth = iconSize * 1.25;
|
2020-10-16 19:52:17 +02:00
|
|
|
const buttonHeight = theme.toolbarHeight - 7;
|
2020-09-15 15:01:07 +02:00
|
|
|
const mdIconPadding = Math.round((buttonHeight - iconSize) / 2) + 3;
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
const innerButton: any = {
|
2020-09-15 15:01:07 +02:00
|
|
|
borderStyle: 'solid',
|
|
|
|
borderColor: theme.color3,
|
|
|
|
borderWidth: 1,
|
|
|
|
borderRadius: 0,
|
|
|
|
width: mdIconWidth + mdIconPadding * 2,
|
|
|
|
height: buttonHeight,
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'center',
|
|
|
|
};
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
const output: any = {
|
2020-09-15 15:01:07 +02:00
|
|
|
button: {
|
|
|
|
border: 'none',
|
|
|
|
padding: 0,
|
|
|
|
display: 'flex',
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
background: 'none',
|
|
|
|
},
|
|
|
|
leftInnerButton: {
|
|
|
|
...innerButton,
|
|
|
|
borderTopLeftRadius: 4,
|
|
|
|
borderBottomLeftRadius: 4,
|
|
|
|
},
|
|
|
|
rightInnerButton: {
|
|
|
|
...innerButton,
|
|
|
|
borderTopRightRadius: 4,
|
|
|
|
borderBottomRightRadius: 4,
|
|
|
|
},
|
|
|
|
leftIcon: {
|
|
|
|
fontSize: iconSize,
|
|
|
|
position: 'relative',
|
2020-11-20 18:19:57 +02:00
|
|
|
top: 1,
|
2020-09-15 15:01:07 +02:00
|
|
|
color: theme.color3,
|
|
|
|
},
|
|
|
|
rightIcon: {
|
|
|
|
fontSize: iconSize - 1,
|
|
|
|
borderLeft: 'none',
|
|
|
|
position: 'relative',
|
2020-11-20 18:19:57 +02:00
|
|
|
top: 1,
|
2020-09-15 15:01:07 +02:00
|
|
|
color: theme.color3,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
if (props.value === Value.Markdown) {
|
|
|
|
output.leftInnerButton.backgroundColor = theme.color3;
|
|
|
|
output.leftIcon.color = theme.backgroundColor3;
|
|
|
|
output.rightInnerButton.opacity = 0.5;
|
|
|
|
} else if (props.value === Value.RichText) {
|
|
|
|
output.rightInnerButton.backgroundColor = theme.color3;
|
|
|
|
output.rightIcon.color = theme.backgroundColor3;
|
|
|
|
output.leftInnerButton.opacity = 0.5;
|
|
|
|
}
|
|
|
|
|
|
|
|
return output;
|
|
|
|
});
|
|
|
|
}
|