Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 1x 1x 1x 1x 2x | import styles from './controls.module.css';
import { BiX, BiMinus, BiExpandAlt } from 'react-icons/bi';
import { clx } from '@/helpers';
type Props = {
disabled?: boolean;
withPadding?: boolean;
onClickClose?: () => Function | void;
onClickMinimise?: () => Function | void;
onClickMaximise?: () => Function | void;
};
/**
* @example
* <ControlButtons />;
*
* @param {boolean} disabled - If true, the maximise button will be disabled
* @param {boolean} withPadding - If true, the container will have padding
* @param {Function} onClickClose - Callback function when close button is clicked
* @param {Function} onClickMinimise - Callback function when minimise button is clicked
* @param {Function} onClickMaximise - Callback function when maximise button is clicked
* @returns {JSX.Element}
*/
const ControlButtons = ({ disabled, withPadding, onClickClose, onClickMinimise, onClickMaximise }: Props) => {
return (
<div data-testid="controls" className={clx(styles.ch_frame_buttons, withPadding ? styles.withPadding : '')}>
<div
onClick={onClickClose}
data-testid="close"
className={clx(styles.ch_frame_button, styles.ch_frame_button_left)}
>
<BiX title="Close" />
</div>
<div
data-testid="minimise"
onClick={onClickMinimise}
className={clx(styles.ch_frame_button, styles.ch_frame_button_middle)}
>
<BiMinus title="Minimise" />
</div>
<div
data-testid="maximise"
onClick={onClickMaximise}
className={clx(
styles.ch_frame_button,
styles.ch_frame_button_right,
disabled ? styles.ch_frame_button_disabled : ''
)}
>
<BiExpandAlt title="Maximise" />
</div>
</div>
);
};
export default ControlButtons;
|