import { useMemo } from 'react'; import { useBlock } from '../../Provider'; import { useBlocks } from '../../Provider/blocksContext'; import { Action, ActionConfig } from '../Action'; import { BaseBlock } from '../BaseBlock'; import { BlocksList, BlocksListConfig } from '../BlocksList'; import { RichText } from '../RichText'; import { BaseBlockConfig } from '../types'; export interface CardConfig extends BaseBlockConfig { template: string; title?: string; subtitle?: string; description?: string; tag?: string; cover?: string; content?: BlocksListConfig; actions?: ActionConfig[]; } interface CardProps extends CardConfig { events: BlockContext['events']; Link: BlocksDependenciesContext['components']['Link']; } export const Card = ({ className, template, title, subtitle, description, tag, cover, content, actions, events, Link, }: CardProps) => { const values = useMemo( () => ({ title, subtitle, description, tag, cover, content, }), [title, subtitle, description, tag, cover, content] ); return {template}; // return ( //
// {cover && ( //
// //
// )} //
// {title &&
{title}
} // {subtitle &&
{subtitle}
} // {description && ( //
{description}
// )} // {tag &&
{tag}
} // {content && ( // // )} // {actions && ( //
// {actions.map((action, key) => ( // // ))} //
// )} //
//
// ); }; const defaultStyles = `:block { position: relative; display: flex; flex-direction: column; } .pr-block-card__container { display: flex; flex-direction: column; } .pr-block-card__title { display: flex; } .pr-block-card__subtitle { display: flex; } .pr-block-card__description { display: flex; } .pr-block-card__tag { display: flex; } .pr-block-card__cover { display: flex; } .pr-block-card__content { display: flex; } .pr-block-card__actions { display: flex; } `; export const CardInContext = () => { const { config, events } = useBlock(); const { components: { Link }, } = useBlocks(); return ( ); }; CardInContext.styles = defaultStyles; export default CardInContext;