Skip to content

Commit

Permalink
feat: card is highlighted when the item was searched for by algolia (#…
Browse files Browse the repository at this point in the history
…122)

* feat: card is highlighted when the item was searched for by algolia

* fix: some visual fixes
  • Loading branch information
nsdonato authored Apr 1, 2024
1 parent 5bfd226 commit 5906a0f
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 15 deletions.
19 changes: 19 additions & 0 deletions components/card/card.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
'use client'

import { useEffect } from 'react'

import { PageItem } from '@/lib/db-types'
import { getFormattedIdentifier } from '@/lib/utils'

Expand All @@ -13,6 +17,21 @@ type CardProps = {
export const Card = ({ item }: CardProps) => {
const { cover, imgPlaceholder, titleCard, infoExtra, links, videos } = item

useEffect(() => {
const highlightedCard =
window.location.hash === `#${getFormattedIdentifier(item.imgPlaceholder)}`

if (highlightedCard) {
const card = document.getElementById(
getFormattedIdentifier(item.imgPlaceholder)
)
card?.classList.add('ring-accent')
setTimeout(() => {
card?.classList.remove('ring-accent')
}, 2000)
}
}, [item.imgPlaceholder])

return (
<div
className='card p-4 ring-1 bg-base-100 shadow-lg h-auto hover:scale-105 transition-transform'
Expand Down
4 changes: 2 additions & 2 deletions db/ciberseguridad/streamers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const streamers: DocPage = {
cover: {
src: '/streamers/hack4u.jpg',
height: 80,
width: 90,
width: 80,
},
videos: [],
},
Expand All @@ -37,7 +37,7 @@ export const streamers: DocPage = {
cover: {
src: '/streamers/securiters.png',
height: 80,
width: 90,
width: 80,
},
videos: [],
},
Expand Down
6 changes: 3 additions & 3 deletions db/extensions/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ const vscode: DocPage = {
titleCard: '',
cover: {
src: '/extensions/vscode/colorize.no-invert.svg',
height: 50,
height: 90,
width: 150,
},
links: [
Expand Down Expand Up @@ -411,8 +411,8 @@ const vscode: DocPage = {
titleCard: '',
cover: {
src: '/extensions/vscode/es7-react-js-icon.png',
height: 70,
width: 70,
height: 80,
width: 120,
},
links: [
{
Expand Down
6 changes: 3 additions & 3 deletions db/frontend/deploys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { DocPage, LinkType } from '@/lib/db-types'
const deploys: DocPage = {
title: 'Deploys en frontend',
description: [
'¿Como hacemos que otra persona pueda ver nuestra web por internet? <br />',
'¿Que herramientas nos permiten publicarla, configurarla, entre otras necesidades? <br />',
'Tu elección va a depender de las necesidades del proyecto y las preferencias del equipo de desarrollo. <br />',
'¿Como hacemos que otra persona pueda ver nuestra web por internet?',
'¿Que herramientas nos permiten publicarla, configurarla, entre otras necesidades?',
'Tu elección va a depender de las necesidades del proyecto y las preferencias del equipo de desarrollo.',
'Algunas de las herramientas más populares son:',
],
contributors: [
Expand Down
2 changes: 1 addition & 1 deletion db/frontend/domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DocPage, LinkType } from '@/lib/db-types'

const domains: DocPage = {
title: 'Dominios',
description: ['Donde comprar tu dominio para tu proyecto'],
description: ['Donde comprar tu dominio para tu proyecto.'],
contributors: [
{ github_username: 'nsdonato' },
{ github_username: 'guguponce' },
Expand Down
3 changes: 2 additions & 1 deletion db/frontend/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { DocPage, LinkType } from '@/lib/db-types'
const fonts: DocPage = {
title: 'Fuentes',
description: [
'Encontrá la tipografía que más se adapte a tu proyecto! <br /> En alguna de las herramientas también podés encontrar combinaciones de fuentes que funcionan bien juntas.',
'Encontrá la tipografía que más se adapte a tu proyecto!',
'En alguna de las herramientas también podés encontrar combinaciones de fuentes que funcionan bien juntas.',
],
contributors: [
{ github_username: 'nsdonato' },
Expand Down
6 changes: 3 additions & 3 deletions db/mobile/streamers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const streamers: DocPage = {
cover: {
src: '/streamers/neryad.png',
height: 80,
width: 90,
width: 80,
},
videos: [],
},
Expand All @@ -45,7 +45,7 @@ const streamers: DocPage = {
cover: {
src: '/streamers/vadim-headshot.webp',
height: 80,
width: 90,
width: 80,
},
videos: [],
},
Expand All @@ -63,7 +63,7 @@ const streamers: DocPage = {
cover: {
src: '/streamers/moure.png',
height: 80,
width: 90,
width: 80,
},
videos: [],
},
Expand Down
2 changes: 1 addition & 1 deletion db/testing/streamers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const streamers: DocPage = {
cover: {
src: '/streamers/charlyautomatiza.png',
height: 80,
width: 90,
width: 80,
},
videos: [],
},
Expand Down
2 changes: 1 addition & 1 deletion db/testing/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DocPage, LinkType } from '@/lib/db-types'

const tools: DocPage = {
title: 'Testing',
description: ['Frameworks o herramientas para testing'],
description: ['Frameworks o herramientas para testing.'],
contributors: [
{
github_username: 'nsdonato',
Expand Down

0 comments on commit 5906a0f

Please sign in to comment.