Skip to content

Commit

Permalink
feat: improvement algolia search, anchoring (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsdonato authored Mar 31, 2024
1 parent c8e12e1 commit 09883d6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
6 changes: 5 additions & 1 deletion app/[menu]/[submenu]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export default async function SubmenuPage({ params }: SubmenuPageProps) {

return (
<>
<Header title={data.title} description={data.description} />
<Header
href={data.title}
title={data.title}
description={data.description}
/>
<div className='grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-4 mt-8'>
{data.pageItems.map(item => (
<Card key={item.imgPlaceholder} item={item} />
Expand Down
1 change: 1 addition & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default async function Home() {
return (
<>
<Header
href='Inicio'
title='Inicio'
description={['En Internet siempre veo las mismas preguntas:']}
/>
Expand Down
7 changes: 5 additions & 2 deletions components/card/card-information.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import { getConferenceInfo } from './utils/card-utils'
type CardTitleProps = {
title?: string
infoExtra?: InfoExtra
href: string
}

export const CardInformation = ({ title, infoExtra }: CardTitleProps) => (
export const CardInformation = ({ title, infoExtra, href }: CardTitleProps) => (
<p className='py-1 truncate text-sm'>
{infoExtra ? getConferenceInfo(infoExtra) : title}
<a className='pointer-events-none' href={`#${href}`}>
{infoExtra ? getConferenceInfo(infoExtra) : title}
</a>
</p>
)
16 changes: 12 additions & 4 deletions components/card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,22 @@ export const Card = ({ item }: CardProps) => {
const { cover, imgPlaceholder, titleCard, infoExtra, links, videos } = item

return (
<div className='card p-4 ring-1 bg-base-100 shadow-lg h-auto hover:scale-105 transition-transform'>
<div
className='card p-4 ring-1 bg-base-100 shadow-lg h-auto hover:scale-105 transition-transform'
id={imgPlaceholder}>
<CardBody cover={cover} imgPlaceholder={imgPlaceholder} />
<>
<p id={imgPlaceholder} className='py-1 truncate'>
{imgPlaceholder}{' '}
<p className='py-1 truncate'>
<a className='pointer-events-none' href={`#${imgPlaceholder}`}>
{imgPlaceholder}
</a>
</p>
<div className='divider m-0 p-0'></div>
<CardInformation title={titleCard} infoExtra={infoExtra} />
<CardInformation
href={imgPlaceholder}
title={titleCard}
infoExtra={infoExtra}
/>
<div className='flex flex-wrap gap-2 pt-1'>
{links?.map(({ url, type }, index) => (
<WebLink
Expand Down
11 changes: 8 additions & 3 deletions components/header/header.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
type HeaderProps = {
title: string
description: string[]
href?: string
}

export const Header = ({ title, description }: HeaderProps) => {
export const Header = ({ title, description, href }: HeaderProps) => {
return (
<header>
<h1 className='text-5xl font-bold mb-10 underline underline-offset-8 decoration-pink-500'>
{title}
<h1
id={`${href ?? title}`}
className='text-5xl font-bold mb-10 underline underline-offset-8 decoration-pink-500 block'>
<a className='pointer-events-none' href={`#${href ?? title}`}>
{title}
</a>
</h1>
{description.map((parrafo, index) => (
<p key={index} className='text-balance last-of-type:pt-4'>
Expand Down

0 comments on commit 09883d6

Please sign in to comment.