2024-01-18 13:22:20 +02:00
|
|
|
import * as React from 'react';
|
2022-08-29 15:19:04 +02:00
|
|
|
|
|
|
|
import { _ } from '@joplin/lib/locale';
|
|
|
|
import ToolbarButton from './ToolbarButton';
|
|
|
|
import { ButtonSpec, StyleSheetData } from './types';
|
|
|
|
|
|
|
|
type OnToggleOverflowCallback = ()=> void;
|
|
|
|
interface ToggleOverflowButtonProps {
|
|
|
|
overflowVisible: boolean;
|
|
|
|
onToggleOverflowVisible: OnToggleOverflowCallback;
|
|
|
|
styleSheet: StyleSheetData;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Button that shows/hides the overflow menu.
|
2024-01-18 13:22:20 +02:00
|
|
|
const ToggleOverflowButton: React.FC<ToggleOverflowButtonProps> = (props: ToggleOverflowButtonProps) => {
|
2022-08-29 15:19:04 +02:00
|
|
|
const spec: ButtonSpec = {
|
2024-01-18 13:22:20 +02:00
|
|
|
icon: 'material more-horiz',
|
2022-08-29 15:19:04 +02:00
|
|
|
description:
|
|
|
|
props.overflowVisible ? _('Hide more actions') : _('Show more actions'),
|
|
|
|
active: props.overflowVisible,
|
|
|
|
onPress: props.onToggleOverflowVisible,
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ToolbarButton
|
|
|
|
styleSheet={props.styleSheet}
|
|
|
|
spec={spec}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
export default ToggleOverflowButton;
|