All files / modules/72-templates-library/components/TemplateCard/TemplateColor TemplateColor.tsx

100% Statements 8/8
100% Branches 0/0
100% Functions 1/1
100% Lines 7/7

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              39x 39x 39x 39x               39x 69x   69x                                  
/*
 * Copyright 2021 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 cx from 'classnames'
import { Text } from '@wings-software/uicore'
import css from './TemplateColor.module.scss'
 
export interface TemplateColorProps {
  fill: string
  stroke: string
  title: string
  textColor?: string
}
export const TemplateColor: React.FC<TemplateColorProps> = (props): JSX.Element => {
  const { fill, stroke, title, textColor } = props
 
  return (
    <div className={css.templateColor}>
      <div className={css.absolutePos}>
        <svg width="121" height="18" viewBox="0 0 121 18" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path
            d="M10.6577 4.36758L0.989019 17.5H120.044L111.076 4.58226C109.301 2.02513 106.385 0.5 103.272 0.5H18.3079C15.288 0.5 12.4481 1.93575 10.6577 4.36758Z"
            fill={fill}
            stroke={stroke}
          />
        </svg>
      </div>
      <Text className={cx(css.text, css.absolutePos)} style={{ color: textColor }}>
        {title}
      </Text>
    </div>
  )
}