mirror of
https://github.com/lux-tel/session-desktop.git
synced 2026-10-30 20:33:24 +00:00
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import type { SettingsChevron } from 'react';
|
|
import { LUCIDE_ICONS_UNICODE } from '../../icon/lucide';
|
|
import { SessionLucideIconButton } from '../../icon/SessionIconButton';
|
|
import {
|
|
GenericPanelButtonWithAction,
|
|
type GenericPanelButtonProps,
|
|
} from './GenericPanelButtonWithAction';
|
|
import { AnimatedSpinnerIcon } from '../../loading/spinner/AnimatedSpinnerIcon';
|
|
|
|
type PanelChevronButtonProps = Pick<GenericPanelButtonProps, 'textElement'> & {
|
|
onClick?: (...args: Array<any>) => void;
|
|
disabled?: boolean;
|
|
baseDataTestId: SettingsChevron;
|
|
showAnimatedSpinnerIcon?: boolean;
|
|
};
|
|
|
|
export const PanelChevronButton = (props: PanelChevronButtonProps) => {
|
|
const { onClick, disabled = false, baseDataTestId, textElement, showAnimatedSpinnerIcon } = props;
|
|
|
|
return (
|
|
<GenericPanelButtonWithAction
|
|
onClick={disabled ? undefined : onClick}
|
|
rowDataTestId={`${baseDataTestId}-settings-row`}
|
|
textElement={textElement}
|
|
actionElement={
|
|
showAnimatedSpinnerIcon ? (
|
|
<AnimatedSpinnerIcon size="huge" />
|
|
) : (
|
|
<SessionLucideIconButton
|
|
disabled={disabled}
|
|
dataTestId={`${baseDataTestId}-settings-chevron`}
|
|
unicode={LUCIDE_ICONS_UNICODE.CHEVRON_RIGHT}
|
|
iconSize="medium"
|
|
iconColor="var(--text-primary-color)"
|
|
style={{ paddingInlineEnd: 'var(--margins-xs)' }}
|
|
/>
|
|
)
|
|
}
|
|
/>
|
|
);
|
|
};
|