Commit daddaa2a authored by Chunchi Che's avatar Chunchi Che

Optimize/select option

parent ec810a55
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
top: -webkit-fill-available; top: -webkit-fill-available;
margin: auto; margin: auto;
height: fit-content; height: fit-content;
transition: 0.3s; transition: 0.2s;
} }
.mini { .mini {
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
bottom: 0 !important; bottom: 0 !important;
transform: translateY(calc(50% - 66px)); transform: translateY(calc(50% - 66px));
.ant-modal-body { .ant-modal-body {
animation: fadeout 0.3s forwards; animation: fadeout 0.1s forwards;
} }
} }
......
.container {
:global(.ant-pro-checkcard-description) {
font-family: var(--theme-font);
font-size: 0.9rem;
display: flex;
align-items: center;
justify-content: center;
}
:global(.ant-pro-checkcard) {
background-color: #1414142b;
}
:global(.ant-pro-checkcard-checked) {
&::before {
position: absolute;
width: 100%;
height: 100%;
content: "";
z-index: 1;
background-color: #0023bf32;
box-shadow: 0 0 0 1px #0087e6 inset;
}
&::after {
display: none;
}
}
.check-card-group {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0.625rem;
}
.check-card {
max-width: 12.5rem;
margin-inline-end: 0;
margin-block-end: 0;
}
}
...@@ -16,6 +16,7 @@ import { Container } from "@/container"; ...@@ -16,6 +16,7 @@ import { Container } from "@/container";
import { getUIContainer } from "@/container/compat"; import { getUIContainer } from "@/container/compat";
import { NeosModal } from "../NeosModal"; import { NeosModal } from "../NeosModal";
import styles from "./index.module.scss";
type Options = { info: string; response: number }[]; type Options = { info: string; response: number }[];
...@@ -53,6 +54,13 @@ export const OptionModal = () => { ...@@ -53,6 +54,13 @@ export const OptionModal = () => {
setSelecteds(Array.from({ length: maxPage }).map((_) => [])); setSelecteds(Array.from({ length: maxPage }).map((_) => []));
}, [options]); }, [options]);
const onQuickSelect = (response: number) => {
if (store.min === 1) {
sendSelectOptionResponse(container.conn, response);
rs();
}
};
return ( return (
<NeosModal <NeosModal
title={title} title={title}
...@@ -67,35 +75,31 @@ export const OptionModal = () => { ...@@ -67,35 +75,31 @@ export const OptionModal = () => {
{grouped.map( {grouped.map(
(options, i) => (options, i) =>
i === page && ( i === page && (
<CheckCard.Group <div className={styles.container} key={i}>
key={i} <CheckCard.Group
bordered bordered
multiple multiple
value={selecteds[i]} value={selecteds[i]}
style={{ className={styles["check-card-group"]}
display: "grid", onChange={(values: any) => {
gridTemplateColumns: "repeat(2, 1fr)", const v = selecteds.map((x, i) => (i === page ? values : x));
gap: "0.625rem", setSelecteds(v);
}} }}
onChange={(values: any) => { >
const v = selecteds.map((x, i) => (i === page ? values : x)); {options.map((option, idx) => (
setSelecteds(v); <div
}} key={idx}
> onDoubleClick={() => onQuickSelect(option.response)}
{options.map((option, idx) => ( >
<CheckCard <CheckCard
key={idx} className={styles["check-card"]}
style={{ description={option.info}
width: "12.5rem", value={option.response}
fontSize: "1rem", />
marginInlineEnd: 0, </div>
marginBlockEnd: 0, ))}
}} </CheckCard.Group>
title={option.info} </div>
value={option.response}
/>
))}
</CheckCard.Group>
), ),
)} )}
</NeosModal> </NeosModal>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment