Skip to content

Commit

Permalink
fix: formatting identifier because it cant be camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
nsdonato committed Mar 31, 2024
1 parent de8b8ec commit 7e32cf5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 1 addition & 5 deletions app/[menu]/[submenu]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ export default async function SubmenuPage({ params }: SubmenuPageProps) {

return (
<>
<Header
href={data.title}
title={data.title}
description={data.description}
/>
<Header 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
5 changes: 4 additions & 1 deletion components/card/card-information.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { InfoExtra } from '@/lib/db-types'
import { getFormattedIdentifier } from '@/lib/utils'

import { getConferenceInfo } from './utils/card-utils'

Expand All @@ -10,7 +11,9 @@ type CardTitleProps = {

export const CardInformation = ({ title, infoExtra, href }: CardTitleProps) => (
<p className='py-1 truncate text-sm'>
<a className='pointer-events-none' href={`#${href}`}>
<a
className='pointer-events-none'
href={`#${getFormattedIdentifier(href)}`}>
{infoExtra ? getConferenceInfo(infoExtra) : title}
</a>
</p>
Expand Down
7 changes: 5 additions & 2 deletions components/card/card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PageItem } from '@/lib/db-types'
import { getFormattedIdentifier } from '@/lib/utils'

import { Video } from '../video/video'
import { WebLink } from '../web-link/web-link'
Expand All @@ -15,11 +16,13 @@ export const Card = ({ item }: CardProps) => {
return (
<div
className='card p-4 ring-1 bg-base-100 shadow-lg h-auto hover:scale-105 transition-transform'
id={imgPlaceholder}>
id={getFormattedIdentifier(imgPlaceholder)}>
<CardBody cover={cover} imgPlaceholder={imgPlaceholder} />
<>
<p className='py-1 truncate'>
<a className='pointer-events-none' href={`#${imgPlaceholder}`}>
<a
className='pointer-events-none'
href={`#${getFormattedIdentifier(imgPlaceholder)}`}>
{imgPlaceholder}
</a>
</p>
Expand Down
4 changes: 4 additions & 0 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ import { twMerge } from 'tailwind-merge'
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}

export const getFormattedIdentifier = (href: string) => {
return href.split(' ').join('-').toLowerCase().replace('.', '-')
}

0 comments on commit 7e32cf5

Please sign in to comment.