Download src/components/shared/modals/modal-body.tsx from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 986 Bytes
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/components/shared/modals/modal-body.tsx
- Command line
-
hf download hf://SaylorTwift/openhands/src/components/shared/modals/modal-body.tsx
-
curl -L -o modal-body.tsx https://huggingface.co/SaylorTwift/openhands/resolve/main/src/components/shared/modals/modal-body.tsx
986 Bytes
| import React from "react"; | |
| import { cn } from "#/utils/utils"; | |
| /** Shared modal content widths (sm / md / lg / xl). */ | |
| export type ModalWidth = "sm" | "md" | "lg" | "xl"; | |
| export const MODAL_WIDTH_CLASS: Record<ModalWidth, string> = { | |
| sm: "w-[384px]", | |
| md: "w-[520px]", | |
| lg: "w-[640px]", | |
| xl: "w-[720px]", | |
| }; | |
| export const MODAL_MAX_WIDTH_VIEWPORT = "max-w-[90vw]"; | |
| export function modalWidthClassName(width: ModalWidth): string { | |
| return MODAL_WIDTH_CLASS[width]; | |
| } | |
| interface ModalBodyProps { | |
| testID?: string; | |
| children: React.ReactNode; | |
| className?: React.HTMLProps<HTMLDivElement>["className"]; | |
| width?: ModalWidth; | |
| } | |
| export function ModalBody({ | |
| testID, | |
| children, | |
| className, | |
| width = "sm", | |
| }: ModalBodyProps) { | |
| return ( | |
| <div | |
| data-testid={testID} | |
| className={cn( | |
| "bg-base-secondary flex flex-col gap-6 items-center p-6 rounded-xl", | |
| modalWidthClassName(width), | |
| className, | |
| )} | |
| > | |
| {children} | |
| </div> | |
| ); | |
| } | |