(props: {
actionTag: ActionTagJoin;
close: () => void;
setActionTag: (actionGroup: ActionTagJoin) => void;
})
| 7 | import { ActionTagJoin } from "../../lib/types"; |
| 8 | |
| 9 | export default function EditActionGroupModal(props: { |
| 10 | actionTag: ActionTagJoin; |
| 11 | close: () => void; |
| 12 | setActionTag: (actionGroup: ActionTagJoin) => void; |
| 13 | }) { |
| 14 | const saveRef = useRef(null); |
| 15 | const [invalid, setInvalid] = React.useState<boolean | null>(null); |
| 16 | const [localActionGroup, setLocalActionGroup] = React.useState<ActionTagJoin>( |
| 17 | props.actionTag, |
| 18 | ); |
| 19 | |
| 20 | return ( |
| 21 | <Modal |
| 22 | open={!!props.actionTag} |
| 23 | setOpen={props.close} |
| 24 | classNames={"max-w-xl"} |
| 25 | > |
| 26 | <div className="flex flex-row justify-between"> |
| 27 | <div className="flex flex-row place-items-center gap-x-4"> |
| 28 | <div className="flex h-10 w-10 items-center justify-center rounded-full bg-sky-100"> |
| 29 | <PencilSquareIcon |
| 30 | className="h-6 w-6 text-sky-600" |
| 31 | aria-hidden="true" |
| 32 | /> |
| 33 | </div> |
| 34 | <div> |
| 35 | <Dialog.Title as="h3" className="text-xl leading-6 text-gray-100"> |
| 36 | Edit Action Group |
| 37 | </Dialog.Title> |
| 38 | <p className="mt-1 text-sm text-gray-500"> |
| 39 | These are called <i>tags</i> in OpenAPI terminology. |
| 40 | </p> |
| 41 | </div> |
| 42 | </div> |
| 43 | </div> |
| 44 | |
| 45 | <div className="relative mt-6 mb-4"> |
| 46 | {localActionGroup.name.length > 30 && ( |
| 47 | <div |
| 48 | className={classNames( |
| 49 | "absolute top-4 text-xs -right-10 z-10", |
| 50 | localActionGroup.name.length === 40 |
| 51 | ? "text-red-500" |
| 52 | : "text-gray-500", |
| 53 | )} |
| 54 | > |
| 55 | {localActionGroup.name.length}/40 |
| 56 | </div> |
| 57 | )} |
| 58 | <FloatingLabelInput |
| 59 | className={classNames( |
| 60 | "px-4 text-gray-900 border-gray-200 border focus:border-sky-500 focus:ring-sky-500 focus:ring-1 ", |
| 61 | invalid && localActionGroup.name === "" |
| 62 | ? "ring-2 ring-offset-1 ring-red-500" |
| 63 | : "", |
| 64 | )} |
| 65 | floatingClassName={ |
| 66 | invalid && localActionGroup.name === "" |
nothing calls this directly
no test coverage detected