All files / modules/70-pipeline/components/TrialModalTemplate TrialModalTemplate.tsx

100% Statements 12/12
100% Branches 4/4
100% Functions 1/1
100% Lines 12/12

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 51 52 53 54 55 56 57 58              12x 12x 12x 12x 12x 12x 12x               12x 31x 31x 31x   31x                                                              
/*
 * 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 from 'react'
import { Layout, Container, Text } from '@wings-software/uicore'
import { Color } from '@harness/design-system'
import { useStrings } from 'framework/strings'
import { useQueryParams } from '@common/hooks'
import { ModuleLicenseType } from '@common/constants/SubscriptionTypes'
import css from './TrialModalTemplate.module.scss'
 
interface TrialModalTemplateProps {
  imgSrc: string
  hideTrialBadge?: boolean
  children: React.ReactElement
}
 
export function TrialModalTemplate({ imgSrc, hideTrialBadge, children }: TrialModalTemplateProps): React.ReactElement {
  const { getString } = useStrings()
  const { modal } = useQueryParams<{ modal?: ModuleLicenseType }>()
  const showTrialBadge = !hideTrialBadge && modal === ModuleLicenseType.TRIAL
 
  return (
    <Layout.Vertical padding={{ top: 'large', right: 'xxxlarge', bottom: 'xxxlarge' }}>
      <Layout.Horizontal padding={{ top: 'large' }}>
        <Container
          className={css.left}
          width="50%"
          style={{
            background: `transparent url(${imgSrc}) no-repeat`
          }}
        >
          {showTrialBadge && (
            <Text
              className={css.tag}
              width={120}
              padding={'xsmall'}
              border={{ radius: 3 }}
              color={Color.WHITE}
              background={Color.ORANGE_500}
              font={{ align: 'center' }}
            >
              {getString('common.trialInProgress')}
            </Text>
          )}
        </Container>
        <Container padding={{ left: 'xxxlarge' }} width={'50%'} className={css.setupForm}>
          {children}
        </Container>
      </Layout.Horizontal>
    </Layout.Vertical>
  )
}