Sha256: 8b1ac6ae7a1c3c22dc2fb92409f8eab8fb68a5e49d1264bb68925e2f58f534d5
Contents?: true
Size: 1.5 KB
Versions: 10
Compression:
Stored size: 1.5 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', 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 ( <Tag {...ariaProps} {...dataProps} id={id} > <If condition={imageUrl}> <div className={classes + 'lazyload blur_up'} style={backgroundStyle} > { children } </div> <Else /> <div className={classes}> { children } </div> </If> </Tag> ) } export default Background
Version data entries
10 entries across 10 versions & 1 rubygems