import classNames from 'classnames' import dayjs from 'dayjs' import React from 'react' import { Text, types, getPageValues } from 'react-bricks/rsc' import DefaultAvatar from './DefaultAvatar' import Section from '../../shared/components/Section' import Container from '../../shared/components/Container' import blockNames from '../../blockNames' import { textColors } from '../../colors' import { LayoutProps, sectionDefaults } from '../../LayoutSideProps' export interface BlogTitleProps extends LayoutProps { title?: string } const BlogTitle: types.Brick = ({ backgroundColor, borderTop, borderBottom, paddingTop, paddingBottom, }) => { const pageValues = getPageValues() return (
{ return (

{prop.children}

) }} placeholder="Post title" /> { return (

{prop.children}

) }} placeholder="Post subtitle" />
{pageValues?.author.avatarUrl ? ( // eslint-disable-next-line @next/next/no-img-element Author ) : ( )}
{pageValues?.author.firstName || 'John'}{' '} {pageValues?.author.lastName || 'Doe'}
{dayjs(pageValues?.publishedAt || new Date()).format( 'MMMM DD, YYYY' )}
) } BlogTitle.schema = { name: blockNames.BlogTitle, label: 'Blog Title', category: 'single column / blog', tags: ['blog', 'title', 'blog title'], previewImageUrl: `/bricks-preview-images/${blockNames.BlogTitle}.png`, playgroundLinkLabel: 'View source code on Github', playgroundLinkUrl: 'https://github.com/ReactBricks/reactbricks-starters/blob/main/packages/reactbricks-ui/nextjs-app/src/singleColumnContent/BlogTitle/BlogTitle.tsx', getDefaultProps: () => ({ ...sectionDefaults, width: 'small', paddingTop: '12', paddingBottom: '8', title: 'A new fresh post', subtitle: 'With a beautiful subtitle', }), } export default BlogTitle