import classNames from 'classnames' import React from 'react' import { types } from 'react-bricks/frontend' import { Text, Image, Link } from 'react-bricks/frontend' import blockNames from '../../blockNames' import { textColors } from '../../colors' import { icons } from '../../shared/defaultImages' interface LinkCardProps { withIcon: boolean withTitle: boolean withLink: boolean linkPath: string logo: types.IImageSource title: types.TextValue text: types.TextValue } const LinkCard: types.Brick = ({ withIcon, withTitle, linkPath, logo, title, text, }) => { return (
{withIcon && ( logo )}
{withTitle && ( (
{props.children}
)} placeholder="Title..." propName="title" value={title} /> )}
{props.children}
} placeholder="Text..." propName="text" value={text} />
) } LinkCard.schema = { name: blockNames.LinkCard, 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-pages/src/mainContent/LinkCards/LinkCard.tsx', getDefaultProps: () => ({ withIcon: true, withTitle: true, icon: icons.PHOTO_STACK, title: 'Visual editing', text: 'The best UX on the market, no training required.', linkPath: '/', }), sideEditProps: [ { name: 'withIcon', label: 'With Icon', type: types.SideEditPropType.Boolean, }, { name: 'withTitle', label: 'With Title', type: types.SideEditPropType.Boolean, }, { name: 'linkPath', label: 'Link to', type: types.SideEditPropType.Text, }, ], } export default LinkCard