import React from 'react' import classNames from 'classnames' import { types, Text, Plain } from 'react-bricks/rsc' import blockNames from '../blockNames' import { pricingColors, PricingColorValue } from '../colors' interface PlanFeatureProps { withTag?: boolean featureText: types.TextValue tag: types.TextValue pricingColor: PricingColorValue } const PlanFeature: types.Brick = ({ withTag, featureText, tag, pricingColor, }) => { const featureTextContent = typeof featureText === 'string' ? featureText : Plain.serialize(featureText) return (
{featureTextContent === '' ? null : ( )} {props.children}} placeholder="type a text" /> {withTag && featureTextContent !== '' ? ( (
{props.children}
)} placeholder="tag" /> ) : null}
) } PlanFeature.schema = { name: blockNames.PlanFeature, label: 'Feature', category: 'pricing', playgroundLinkLabel: 'View source code on Github', playgroundLinkUrl: 'https://github.com/ReactBricks/reactbricks-starters/blob/main/packages/reactbricks-ui/nextjs-app/src/pricing/PlanFeature.tsx', hideFromAddMenu: true, getDefaultProps: () => ({ featureText: 'Up to 10 users', withTag: false, tag: 'Add-on', }), sideEditProps: [ { name: 'withTag', label: 'With tag', type: types.SideEditPropType.Boolean, }, ], } export default PlanFeature