import { CSSProperties } from "@theia/core/shared/react";
import * as React from "react";
import { createUseStyles } from "react-jss";
import { EScreenView } from "../../constants";
import { useStorjWidgetContext } from "../StorjWidget/StorjWidget.context";
import { useCommonStyles } from "../StorjWidget/StorjWidget.style";
const useStyles = createUseStyles({
backAction: {
cursor: (props: any) => (props.disabled ? "not-allowed" : "pointer"),
"&:hover": {
textDecoration: (props: any) => (props.disabled ? "none" : "underline"),
},
opacity: (props: any) => (props.disabled ? "30%" : "100%"),
},
});
type Props = {
onClick?: Function;
disabled?: boolean;
style?: CSSProperties;
hideHomeIcon?: boolean;
};
function BackButton(props: Props) {
const { onClick, disabled, style, hideHomeIcon } = props;
const { setPreviousScreen, setCurrentScreen } = useStorjWidgetContext();
const handleClickBack = () => {
if (!onClick) {
setPreviousScreen();
} else {
onClick();
}
};
const handleClickHome = () => {
setCurrentScreen(EScreenView.ACTIONS_SCREEN);
};
const classes = useStyles({ disabled });
const commonClasses = useCommonStyles();
return (
<>
{!hideHomeIcon && (
)}
>
);
}
export default BackButton;