Add view without creator

This commit is contained in:
michey 2021-05-19 09:18:55 +03:00
parent a6a7eaf20c
commit 572d297e22
No known key found for this signature in database
GPG Key ID: 7D4BF433F4970657
2 changed files with 30 additions and 5 deletions

View File

@ -44,6 +44,28 @@ storiesOf('Components/Post Overview Card', module)
return <PostOverviewCard {...defaultPreview} />;
})
.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 <PostOverviewCard {...defaultPreview} />;
})
.add('without tags', () => {
const defaultPreview: PostOverviewCardProps = {
createdAt: DateTime.now(),

View File

@ -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'}></img>
) : null}
<div className={'flex flex-row pt-2 pl-2'}>
<Avatar imgUrl={createdBy.avatar} />
<NameAndData name={createdBy.name} date={createdAt} />
</div>
{isDefined(createdBy) ? (
<div className={'flex flex-row pt-2 pl-2'}>
<Avatar imgUrl={createdBy.avatar} />
<NameAndData name={createdBy.name} date={createdAt} />
</div>
): <div className={'flex flex-row pt-16'}></div>}
<div className={'flex flex-row px-16'}>
<a className={'text-4xl font-bold hover:text-purple-500 '} href={path}>
{title}