import classNames from 'classnames' import React from 'react' import { RichText, Text, Image, Link, Plain, types } from 'react-bricks/rsc' import blockNames from '../../blockNames' import { textColors } from '../../colors' import { icons } from '../../shared/defaultImages' import { BsTicketDetailedFill } from 'react-icons/bs' interface CardProps { withIcon: boolean withTitle: boolean withLink: boolean linkPath: string icon: types.IImageSource title: types.TextValue description: types.TextValue linkText: types.TextValue } const Card: types.Brick = ({ withIcon, withTitle, withLink, linkPath, icon, title, description, linkText, }) => { const linkTextPlain = typeof linkText === 'string' ? linkText : Plain.serialize(linkText) return (
{withIcon && ( logo )}
{withTitle && ( (
{props.children}
)} placeholder="Title..." /> )} (
{props.children}
)} placeholder="Description..." /> {withLink && (

{props.children}

} placeholder="Link..." />
)}
) } Card.schema = { name: blockNames.Card, label: 'Card', category: 'main content', hideFromAddMenu: true, playgroundLinkLabel: 'View source code on Github', playgroundLinkUrl: 'https://github.com/ReactBricks/reactbricks-starters/blob/main/packages/reactbricks-ui/nextjs-app/src/mainContent/Cards/Card.tsx', getDefaultProps: () => ({ withIcon: true, withTitle: true, withLink: true, icon: icons.TWITTER, title: 'Twitter', description: 'Get the latest event updates about React Bricks.', linkText: 'Follow us now', }), sideEditProps: [ { name: 'withIcon', label: 'With Icon', type: types.SideEditPropType.Boolean, }, { name: 'withTitle', label: 'With Title', type: types.SideEditPropType.Boolean, }, { name: 'withLink', label: 'With Link', type: types.SideEditPropType.Boolean, }, { name: 'linkPath', label: 'Link to', type: types.SideEditPropType.Text, show: ({ withLink }, page, user) => !!withLink, }, ], } export default Card