Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / @skava/ui   js

Repository URL to install this package:

Version: 2.8.8 

/ src / components / presets / ProductPieces / ProductPrice / renderProps.tsx

import React from 'react'
import { PriceWrapper, SalePrice, RegularPrice } from './styled'
import { ProductPriceProps } from './typings'

function defaultRenderSalePrice(props: ProductPriceProps) {
  return <SalePrice aria-label="sale-price">{props.salePrice}</SalePrice>
}

function defaultRenderRegularPrice(props: ProductPriceProps) {
  return (
    <RegularPrice aria-label="regular-price" isSalePrice={props.isSalePrice}>{props.regularPrice}</RegularPrice>
  )
}

function defaultRenderWrapper(props: ProductPriceProps) {
  const { className, children } = props
  const passthroughProps = Object.freeze({
    className,
    'data-qa': props['data-qa']
  })
  return (
    <PriceWrapper aria-label="product-price" {...passthroughProps}>{children}</PriceWrapper>
  )
}

export {
  defaultRenderWrapper,
  defaultRenderSalePrice,
  defaultRenderRegularPrice,
}