Add validation to background field

This commit is contained in:
Maksim Eltyshev
2020-06-03 22:27:20 +05:00
parent 7811d60efb
commit f85d499bbf
10 changed files with 130 additions and 25 deletions

View File

@@ -4,6 +4,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { ProjectBackgroundTypes } from '../../constants/Enums';
import styles from './Background.module.scss';
import globalStyles from '../../styles.module.scss';
@@ -11,7 +13,8 @@ const Background = ({ type, name, imageUrl }) => (
<div
className={classNames(
styles.wrapper,
type === 'gradient' && globalStyles[`background${upperFirst(camelCase(name))}`],
type === ProjectBackgroundTypes.GRADIENT &&
globalStyles[`background${upperFirst(camelCase(name))}`],
)}
style={{
background: type === 'image' && `url("${imageUrl}") center / cover`,