diff --git a/app/components/molecules/ThreeDigitsInput.tsx b/app/components/molecules/ThreeDigitsInput.tsx new file mode 100644 index 00000000..39438524 --- /dev/null +++ b/app/components/molecules/ThreeDigitsInput.tsx @@ -0,0 +1,35 @@ +import { REGEXP_ONLY_DIGITS } from "input-otp"; +import { + InputOTP, + InputOTPGroup, + InputOTPSlot, +} from "~/components/ui/input-otp"; + +type props = { + id: string; + value: string; + onChange: (value: string) => void; + disabled: boolean; +}; + +const ThreeDigitsInput = ({ id, value, onChange, disabled }: props) => { + return ( + + + + + + + o + + ); +}; + +export { ThreeDigitsInput }; diff --git a/app/routes/cashier-v2.tsx b/app/routes/cashier-v2.tsx index e5436d23..3f8ec259 100644 --- a/app/routes/cashier-v2.tsx +++ b/app/routes/cashier-v2.tsx @@ -1,18 +1,13 @@ import { parseWithZod } from "@conform-to/zod"; import { type ClientActionFunction, useSubmit } from "@remix-run/react"; -import { REGEXP_ONLY_DIGITS } from "input-otp"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import useSWRSubscription from "swr/subscription"; import { z } from "zod"; +import { ThreeDigitsInput } from "~/components/molecules/ThreeDigitsInput"; import { ItemAssign } from "~/components/organisms/ItemAssign"; import { OrderAlertDialog } from "~/components/organisms/OrderAlertDialog"; import { Button } from "~/components/ui/button"; import { Input } from "~/components/ui/input"; -import { - InputOTP, - InputOTPGroup, - InputOTPSlot, -} from "~/components/ui/input-otp"; import { itemConverter, orderConverter } from "~/firebase/converter"; import { collectionSub } from "~/firebase/subscription"; import { stringToJSONSchema } from "~/lib/custom-zod"; @@ -244,19 +239,12 @@ export default function Cashier() {

割引券番号

- setDiscountOrderId(value)} disabled={inputStatus !== "discount"} - > - - - - - + />

{discountOrder === undefined ? "見つかりません" : null} {discountOrder && `有効杯数: ${lastPurchasedCups}`}