Cmen
3 years ago
13 changed files with 137 additions and 25 deletions
@ -0,0 +1,68 @@
|
||||
import { useSelector } from "react-redux"; |
||||
import { Button } from "antd"; |
||||
|
||||
import { |
||||
editorAction, |
||||
OverlayNamePrefixs, |
||||
statusSelector, |
||||
overlayTypeSelector, |
||||
} from "@store"; |
||||
import { Status } from "@types"; |
||||
|
||||
type MinimalButtonProps = { |
||||
type: string; |
||||
text: string; |
||||
onClick: () => void; |
||||
}; |
||||
|
||||
const MinimalButton = (props: MinimalButtonProps) => { |
||||
return ( |
||||
<Button |
||||
type="dashed" |
||||
size="small" |
||||
icon={<span className={`icon icon-${props.type}`}></span>} |
||||
onClick={props.onClick} |
||||
> |
||||
{props.text} |
||||
</Button> |
||||
); |
||||
}; |
||||
|
||||
export const MinimalTools = () => { |
||||
const status = useSelector(statusSelector); |
||||
|
||||
console.log(status); |
||||
if (status === Status.CreateOverlay || status === Status.EditOverlay) { |
||||
return ( |
||||
<> |
||||
<MinimalButton |
||||
text="完成" |
||||
type="confirm" |
||||
onClick={() => editorAction.finishCreateOverlay()} |
||||
/> |
||||
</> |
||||
); |
||||
} |
||||
if (status === Status.SelectOverlay) { |
||||
return ( |
||||
<> |
||||
<MinimalButton |
||||
text="编辑" |
||||
type="edit" |
||||
onClick={() => editorAction.editSelectedOverlay()} |
||||
/> |
||||
<MinimalButton |
||||
text="复制" |
||||
type="copy" |
||||
onClick={() => editorAction.copyOverlay()} |
||||
/> |
||||
<MinimalButton |
||||
text="删除" |
||||
type="delete" |
||||
onClick={() => editorAction.deleteOverlays()} |
||||
/> |
||||
</> |
||||
); |
||||
} |
||||
return <></>; |
||||
}; |
Loading…
Reference in new issue