import React from 'react';

import {RHSState} from '../../types/general';

import './back_button.scss';

type Props = {
    targetView: RHSState;
    onNavigate: (view: RHSState) => void;
    children: React.ReactNode;
}

const BackButton: React.FC<Props> = ({
    targetView,
    onNavigate,
    children,
}) => {
    return (
        <button
            className='BackButton'
            onClick={() => onNavigate(targetView)}
        >
            {'← '}
            {children}
        </button>
    );
};

export default BackButton;
