Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Allignment issue in the blog page #1029

Merged
merged 12 commits into from
Oct 26, 2024
68 changes: 60 additions & 8 deletions pages/blog/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import { useRouter } from 'next/router';
import useSetUrlParam from '~/lib/useSetUrlParam';
import { SectionContext } from '~/context';

type Author = {
name: string;
photo?: string;
link?: string;
byline?: string;
};
export type blogCategories =
| 'All'
| 'Community'
Expand Down Expand Up @@ -286,14 +292,34 @@ export default function StaticMarkdownPage({
/>
</div>
</div>
<div className='flex flex-row items-center'>
<div className='flex flex-row pl-2 mr-2'>
<div
className={`
flex
flex-row
items-center
`}
>
<div
className={`
flex
flex-row
pl-2
mr-2
`}
>
{(frontmatter.authors || []).map(
(author: any, index: number) => {
(author: Author, index: number) => {
return (
<div
key={index}
className='bg-slate-50 h-[44px] w-[44px] rounded-full -ml-3 bg-cover bg-center border-2 border-white'
className={`bg-slate-50
${frontmatter.authors.length > 2 ? 'h-8 w-8' : 'h-11 w-11'}
rounded-full
-ml-3
bg-cover
bg-center
border-2
border-white`}
style={{
backgroundImage: `url(${author.photo})`,
zIndex: 10 - index,
Expand All @@ -304,11 +330,37 @@ export default function StaticMarkdownPage({
)}
</div>

<div className='flex flex-col items-start'>
<div
className={`
flex
flex-col
items-start
`}
>
<div className='text-sm font-semibold'>
{frontmatter.authors
.map((author: any) => author.name)
.join(' & ')}
{frontmatter.authors.length > 2 ? (
<>
{frontmatter.authors
.slice(0, 2)
.map((author: Author, index: number) => (
<span key={author.name}>
{author.name}
{index === 0 && ' & '}
</span>
))}
{'...'}
</>
) : (
frontmatter.authors.map(
(author: Author, index: number) => (
<span key={author.name}>
{author.name}
{index < frontmatter.authors.length - 1 &&
' & '}
</span>
),
)
)}
</div>

<div className='text-slate-500 text-sm dark:text-slate-300'>
Expand Down