All files / modules/75-cf/components/SaveFlagToGitSubFormModal SaveFlagToGitSubFormModal.tsx

100% Statements 11/11
100% Branches 0/0
100% Functions 2/2
100% Lines 11/11

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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50              13x 13x 13x 13x 13x               13x 232x   232x                               3x 3x                 13x  
/*
 * Copyright 2022 Harness Inc. All rights reserved.
 * Use of this source code is governed by the PolyForm Shield 1.0.0 license
 * that can be found in the licenses directory at the root of this repository, also available at
 * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt.
 */
 
import React, { ReactElement } from 'react'
import { ButtonVariation, Container, Layout, Button } from '@wings-software/uicore'
import { Dialog } from '@blueprintjs/core'
import { useStrings } from 'framework/strings'
import SaveFlagToGitSubForm from '../SaveFlagToGitSubForm/SaveFlagToGitSubForm'
 
interface SaveFlagToGitSubFormModalProps {
  title: string
  onSubmit?: () => void
  onClose: () => void
}
 
const SaveFlagToGitSubFormModal = ({ title, onSubmit, onClose }: SaveFlagToGitSubFormModalProps): ReactElement => {
  const { getString } = useStrings()
 
  return (
    <Dialog enforceFocus={false} isOpen={true} onClose={onClose} title="">
      <Container id="save-flag-to-git-modal-body" padding={{ bottom: 'xlarge', left: 'xlarge', right: 'xlarge' }}>
        <SaveFlagToGitSubForm title={title} />
        <Layout.Horizontal spacing="small" style={{ alignItems: 'center' }} padding={{ top: 'xxlarge' }}>
          <Button
            text={getString('save')}
            variation={ButtonVariation.PRIMARY}
            onClick={onSubmit}
            data-testid="save-flag-to-git-modal-save-button"
          />
          <Button
            text={getString('cancel')}
            variation={ButtonVariation.TERTIARY}
            data-testid="save-flag-to-git-modal-cancel-button"
            onClick={event => {
              event.preventDefault()
              onClose()
            }}
          />
        </Layout.Horizontal>
      </Container>
    </Dialog>
  )
}
 
export default SaveFlagToGitSubFormModal