Skip to content

Commit

Permalink
fix: fixed responsive height and main height overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbrusegard committed Jan 25, 2024
1 parent c14621a commit 83be908
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Footer() {
const t = useTranslations('layout');
const year = new Date().getFullYear();
return (
<footer className='z-10 flex w-full justify-center border-t border-border/40 bg-background/95 px-11 py-10 md:px-16 lg:px-24'>
<footer className='flex w-full justify-center border-t border-border/40 bg-background/95 px-11 py-10 md:px-16 lg:px-24'>
<div className='w-full max-w-screen-2xl text-sm'>
<div className='grid grid-cols-1 gap-x-4 gap-y-12 xs:grid-cols-2 sm:grid-cols-3 lg:grid-cols-4'>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Header() {
events={t('events')}
about={t('about')}
/>
<div>
<div className='flex'>
<LocaleMenu changeLocale={t('changeLocale')} />
<DarkModeMenu
toggleTheme={t('toggleTheme')}
Expand Down
7 changes: 1 addition & 6 deletions src/components/layout/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ type Props = {

function Main({ children, mainClassName, className }: Props) {
return (
<main
className={cx(
'flex h-full w-full flex-grow justify-center',
mainClassName,
)}
>
<main className={cx('flex w-full flex-grow justify-center', mainClassName)}>
<div
className={cx(
'h-full w-full max-w-screen-2xl px-4 sm:px-11 md:px-16 lg:px-24',
Expand Down
51 changes: 29 additions & 22 deletions src/components/news/NewsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,36 @@ type NewsCardProps = {

function NewsCard({ className, id, title, date, photoUrl }: NewsCardProps) {
return (
<Card
className={cx(
'relative flex h-full min-h-32 w-full bg-cover bg-center',
className,
)}
<Button
className={cx('whitespace-normal font-normal', className)}
asChild
variant='none'
size='none'
>
<Image
className='rounded-lg'
src={`/${photoUrl}`}
alt={title}
layout='fill'
objectFit='cover'
objectPosition='center'
/>
<CardHeader className='mt-auto w-full rounded-b-lg bg-background/95 p-4 backdrop-blur supports-[backdrop-filter]:bg-background/60 lg:p-6'>
<CardTitle className='line-clamp-1 text-lg sm:text-xl lg:text-2xl'>
{title}
</CardTitle>
<CardDescription className='line-clamp-1 text-xs sm:text-sm'>
{date}
</CardDescription>
</CardHeader>
</Card>
<Link href={`/news/${id}`}>
<Card
className={cx(
'relative flex h-full min-h-32 w-full bg-cover bg-center',
className,
)}
>
<Image
className='rounded-lg object-cover object-center'
src={`/${photoUrl}`}
alt={title}
fill
/>
<CardHeader className='mt-auto w-full rounded-b-lg bg-background/95 p-4 backdrop-blur supports-[backdrop-filter]:bg-background/60 lg:p-6'>
<CardTitle className='line-clamp-1 text-lg sm:text-xl lg:text-2xl'>
{title}
</CardTitle>
<CardDescription className='line-clamp-1 text-xs sm:text-sm'>
{date}
</CardDescription>
</CardHeader>
</Card>
</Link>
</Button>
);
}

Expand Down

0 comments on commit 83be908

Please sign in to comment.