Skip to content

Commit

Permalink
add sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Yinger committed Sep 21, 2020
1 parent 8a61189 commit 6908def
Show file tree
Hide file tree
Showing 6 changed files with 352 additions and 12 deletions.
12 changes: 5 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ function App() {
}
};

const onDiffClick = (e: React.MouseEvent) => {
e.preventDefault();

diff(leftsheetdata, rightsheetdata, hotTableComponentDiffResult);
};

return (
<div className="App">
<Row>
Expand All @@ -122,7 +116,11 @@ function App() {
<DiffButtonHooks
btntext={diffBtnText}
onDiffBtnClick={(e) => {
onDiffClick(e);
diff(leftsheetdata, rightsheetdata, hotTableComponentDiffResult);
}}
onSampleBtnClick={(e) => {
setLeftSheetData(ExcelHelper.SampleDataLeft);
setRightSheetData(ExcelHelper.SampleDataRight);
}}
/>
</Col>
Expand Down
12 changes: 11 additions & 1 deletion src/components/DiffBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,26 @@ import { Button } from "antd";
interface DiffBtn {
btntext: string;
onDiffBtnClick(e: React.MouseEvent<HTMLElement, MouseEvent>): any;
onSampleBtnClick(e: React.MouseEvent<HTMLElement, MouseEvent>): any;
}

const DiffButtonHooks = (props: DiffBtn) => {
return (
<div style={{ textAlign: "center" }}>
<Button
type="dashed"
size="small"
style={{ marginTop: 150 }}
onClick={(e) => props.onSampleBtnClick(e)}
>
{"< Sample >"}
</Button>
<Button
ref={React.createRef()}
id="btn-diff"
type="primary"
style={{ marginTop: 150 }}
style={{ marginTop: 10 }}
size="large"
onClick={(e) => props.onDiffBtnClick(e)}
>
{props.btntext}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const ImportHooks = (props: Import) => {
return (
<Input.Group
compact
style={{ marginRight: 10, marginTop: -15, marginBottom: 3 }}
style={{ marginRight: 10, marginTop: -25, marginBottom: 3 }}
>
<input
name={"file-upload"}
style={{ width: "50%" }}
style={{ width: "50%", marginTop: 10 }}
type="file"
accept={ExcelHelper.SheetJSFT()}
aria-label="Select original file"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Left.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const LeftHooks = (props: Left) => {
};
return (
<>
<div className="left" style={{ padding: 10 }}>
<div className="left" style={{ padding: 10, marginTop: -25 }}>
<h1 style={{ marginLeft: 3 }}>{"<元・original>"}</h1>
<ImportHooks
sheetname={props.sheetname}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Right.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const RightHooks = (props: Right) => {
};
return (
<>
<div className="right" style={{ padding: 10 }}>
<div className="right" style={{ padding: 10, marginTop: -25 }}>
<h1 style={{ marginLeft: 3 }}>{"<先・modified>"}</h1>
<ImportHooks
sheetname={props.sheetname}
Expand Down
Loading

0 comments on commit 6908def

Please sign in to comment.