Sha256: f6ff932671222e507da614b681315a629224b7d21999717803e348f1c1f7beac
Contents?: true
Size: 1.96 KB
Versions: 18
Compression:
Stored size: 1.96 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props' import { globalProps } from '../utilities/globalProps.js' type BackgroundProps = { aria?: object, backgroundColor?: 'gradient' | 'dark' | 'light' | 'white' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'primary' | 'category_1' | 'category_2' | 'category_3' | 'category_4' | 'category_5' | 'category_6' | 'category_7' | 'category_8' | 'category_9' | 'category_10' | 'category_11' | 'category_12' | 'category_13' | 'category_14' | 'category_15' | 'category_16' | 'category_17' | 'category_18' | 'category_19' | 'category_20' | 'category_21', children?: array<React.ReactNode> | React.ReactNode, className?: string, data?: object, id?: string, imageUrl?: string, padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div', } const Background = (props: BackgroundProps) => { const { aria = {}, backgroundColor = 'light', children, className, data = {}, id, imageUrl = '', tag = 'div', } = props const ariaProps = buildAriaProps(aria) const dataProps = buildDataProps(data) const classes = classnames(buildCss('pb_background_kit'), globalProps(props), `pb_background_color_${backgroundColor}`, className) const Tag = `${tag}` const backgroundStyle = { backgroundImage: `url(${imageUrl})`, backgroundSize: 'cover', } return ( <> <If condition={imageUrl}> <Tag style={backgroundStyle} {...ariaProps} {...dataProps} className={classes} id={id} > { children } </Tag> <Else /> <Tag {...ariaProps} {...dataProps} className={classes} id={id} > { children } </Tag> </If> </> ) } export default Background
Version data entries
18 entries across 18 versions & 1 rubygems