center UI

This commit is contained in:
2023-02-16 23:55:05 +08:00
parent 3b01c2ec76
commit 7738e061fc
2 changed files with 66 additions and 43 deletions

View File

@@ -229,40 +229,42 @@ const Timetable = ({
main();
}, []);
const DownloadMarks = async () => {
console.log("download marks", marks);
const data = {
user,
selections: {},
};
for (const row of marks) {
for (const input of row) {
if (input === null) continue;
if (input.checked) {
data.selections[input.name] = 1;
} else if (parseFloat(input.value)) {
data.selections[input.name] = parseFloat(input.value);
}
}
}
console.log(data);
downloadObjectAsJson(data, user);
};
return (
<>
<button
onClick={async () => {
console.log("download marks", marks);
const data = {
user,
selections: {},
};
for (const row of marks) {
for (const input of row) {
if (input === null) continue;
if (input.checked) {
data.selections[input.name] = 1;
} else if (parseFloat(input.value)) {
data.selections[input.name] = parseFloat(input.value);
}
}
}
console.log(data);
downloadObjectAsJson(data, user);
}}
>
DownloadSelection
</button>
<span>Login as {user}</span>
<h2 style={{textAlign: 'center'}}>Login as {user}</h2>
<div
ref={ref}
contentEditable={editable}
style={{
overflow: "scroll",
display: 'flex',
justifyContent: 'center',
}}
onInput={handleInput}
></div>{" "}
<p style={{ display: "flex", justifyContent: "center" }}>
<button onClick={DownloadMarks}>Download Selection</button>
</p>
<div style={{ display: "none" }} id="download-dom"></div>
</>
);