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