All files / components/modals/FormModal FormModal.tsx

100% Statements 5/5
83.33% Branches 10/12
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 361x 1x     1x                 4x                                         1x  
import { Body, Buttons, Content } from "./styled"
import Button from "components/buttons/Button"
import { ComponentProps } from "."
 
const FormModal = ({
  cancelLabel,
  children,
  isDisabled,
  isLoading,
  onClose,
  onSubmit,
  submitLabel
}: ComponentProps) => (
  <form onSubmit={onSubmit}>
    <Content>
      <Body>{children}</Body>
      <Buttons>
        <Button
          disabled={isDisabled || isLoading}
          label={cancelLabel ?? "Cancel"}
          onClick={onClose}
          outlined
        />
        <Button
          disabled={isDisabled || isLoading}
          label={submitLabel ?? "Submit"}
          loading={isLoading}
          type="submit"
        />
      </Buttons>
    </Content>
  </form>
)
 
export default FormModal