diff --git a/components/post-overview/PostOverviewCard.stories.tsx b/components/post-overview/PostOverviewCard.stories.tsx index 922d165..39cf417 100644 --- a/components/post-overview/PostOverviewCard.stories.tsx +++ b/components/post-overview/PostOverviewCard.stories.tsx @@ -44,6 +44,28 @@ storiesOf('Components/Post Overview Card', module) return ; }) + .add('with preview/without avatar', () => { + const defaultPreview: PostOverviewCardProps = { + createdAt: DateTime.now(), + path: '/blog/asdasdasdasd', + title: 'How to create your personal static blog and do not lost your mind. 🔥', + preview: { + headerMedia: { + key: 'Image', + url: './pattern.png', + alt: 'awesome pattern' + } + }, + tags: [ + { text: 'next.js' }, + { text: 'typescript' }, + { text: 'tailwind' }, + { text: 'storybook' } + ] + }; + + return ; + }) .add('without tags', () => { const defaultPreview: PostOverviewCardProps = { createdAt: DateTime.now(), diff --git a/components/post-overview/PostOverviewCard.tsx b/components/post-overview/PostOverviewCard.tsx index 64355a2..785803b 100644 --- a/components/post-overview/PostOverviewCard.tsx +++ b/components/post-overview/PostOverviewCard.tsx @@ -10,7 +10,7 @@ import Tags from './elements/Tags'; export type PostOverviewCardProps = { createdAt: DateTime; - createdBy: User; + createdBy?: User; path: string; title: string; preview: Preview; @@ -26,10 +26,13 @@ export default ({ createdBy, createdAt, title, tags, path, preview }: PostOvervi className={'object-cover h-52 w-full'}> ) : null} -
- - -
+ {isDefined(createdBy) ? ( +
+ + +
+ ):
} +
{title}