import React, { FC, ReactNode, useEffect, useRef, useState } from 'react'; import css from './index.module.css'; import classNames from 'classnames'; import SaleSVG from '../../assets/icons/ribbon-sale.svg'; export interface RowsProps { children?: ReactNode; variant?: | 'default' | 'bubble' | 'table' | 'roles' | 'cards' | 'cards-small' | 'partners' | 'campaign'; width?: string; fullWidthCampaign?: boolean; } const Rows: FC = ({ children, variant = 'default', width, fullWidthCampaign = false, }) => { const ref = useRef(null); const [circleColor, setCircleColor] = useState('#FAFAFA'); useEffect(() => { if (variant === 'bubble') { const backgroundColor = window.getComputedStyle(ref.current.parentNode) .backgroundColor; setCircleColor( backgroundColor && backgroundColor === 'rgb(250, 250, 250)' ? '#FFFFFF' : '#FAFAFA', ); } }, [variant]); return (
{React.Children.map(children, child => { return variant === 'campaign' && !fullWidthCampaign ? (
{child}
) : (
{child} {variant === 'bubble' && (
)}
); })}
); }; export default Rows;