mirror of
https://github.com/lux-tel/session-desktop.git
synced 2026-10-30 20:33:24 +00:00
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-misused-promises */
|
|
import { SessionDataTestId } from 'react';
|
|
import { SessionToggle } from '../../basic/SessionToggle';
|
|
import {
|
|
GenericPanelButtonWithAction,
|
|
type GenericPanelButtonProps,
|
|
} from './GenericPanelButtonWithAction';
|
|
|
|
type PanelToggleButtonProps = Pick<GenericPanelButtonProps, 'rowDataTestId' | 'textElement'> & {
|
|
active: boolean;
|
|
onClick: () => Promise<void>;
|
|
toggleDataTestId: SessionDataTestId;
|
|
disabled?: boolean;
|
|
};
|
|
|
|
export const PanelToggleButton = (props: PanelToggleButtonProps) => {
|
|
const { active, onClick, toggleDataTestId, disabled = false, rowDataTestId, textElement } = props;
|
|
|
|
return (
|
|
<GenericPanelButtonWithAction
|
|
onClick={disabled ? undefined : onClick}
|
|
rowDataTestId={rowDataTestId}
|
|
textElement={textElement}
|
|
actionElement={
|
|
<SessionToggle
|
|
active={active}
|
|
dataTestId={toggleDataTestId}
|
|
style={{ paddingInlineEnd: 'var(--margins-xs)' }}
|
|
onClick={onClick}
|
|
/>
|
|
}
|
|
/>
|
|
);
|
|
};
|