Skip to content

Commit 107482d

Browse files
committed
ver más fix
1 parent 6429aa8 commit 107482d

26 files changed

+103
-277
lines changed

components/cards/ProjectCard.jsx

Lines changed: 58 additions & 240 deletions
Original file line numberDiff line numberDiff line change
@@ -1,220 +1,3 @@
1-
// "use client";
2-
3-
// import clsx from "clsx";
4-
// import * as React from "react";
5-
// import { useState } from "react";
6-
// import Link from "next/link";
7-
8-
// import { Slot } from "@radix-ui/react-slot";
9-
// import { cva } from "class-variance-authority";
10-
// import { cn } from "@/lib/utils";
11-
12-
// // Data
13-
// import { useTranslation } from "react-i18next";
14-
// import { researchlines } from "@/constants/researchlines";
15-
16-
// // Components
17-
// import Heading from "../ui/Heading";
18-
// import { Mybadge, badgeVariants } from "../ui/mybadge";
19-
// import { Button, ButtonVariants } from "../ui/button";
20-
// import Image from "../ui/image";
21-
// import { Divider } from "../ui/divider";
22-
// import ResearchlineIllust from "../illustrations/ResearchlineIllust";
23-
// import {
24-
// CustomCard,
25-
// CardBody,
26-
// CardContent,
27-
// CardTitle,
28-
// CardSubtitle,
29-
// CardDescription,
30-
// CardFooter,
31-
// CardHeader,
32-
// } from "@/components/ui/customCard";
33-
34-
// // Icons
35-
// import { ExternalLinkIcon } from "@radix-ui/react-icons";
36-
37-
// const Card = React.forwardRef(
38-
// (
39-
// {
40-
// direction,
41-
// className,
42-
// title,
43-
// description_en,
44-
// description_es,
45-
// img,
46-
// route,
47-
// researchLine,
48-
// logo,
49-
// projectType = "european-project",
50-
// },
51-
// ref
52-
// ) => {
53-
// const { t, i18n } = useTranslation();
54-
// const currentLang = i18n.language;
55-
56-
// // PARA PROJECTCARD / teamcard
57-
// // Manejo de estado para ver si se ha expandido el "ver más" del texto
58-
// const [isExpanded, setIsExpanded] = useState(false);
59-
// const toggleDescription = () => {
60-
// setIsExpanded((prevState) => !prevState); // Alterna entre true y false,
61-
// };
62-
63-
// //elegir description o description_es según el currentLang
64-
// let description_translation = description_en;
65-
// if (currentLang == "es" && description_es) {
66-
// description_translation = description_es;
67-
// }
68-
69-
// // fondo researchline cards - project cards
70-
// let backgroundColor;
71-
72-
// // coge solo la primera researchline para ponerle el fondo
73-
// switch (researchLine && researchLine[0]) {
74-
// case "data":
75-
// backgroundColor = "bg-data_bg"; // Para la categoría 'data'
76-
// break;
77-
// case "videoconference":
78-
// backgroundColor = "bg-videoconference_bg"; // Para la categoría 'videoconference'
79-
// break;
80-
// case "ai":
81-
// backgroundColor = "bg-ai_bg"; // Para la categoría 'ai'
82-
// break;
83-
// case "computing":
84-
// backgroundColor = "bg-networks_bg"; // Para la categoría 'ai'
85-
// break;
86-
// case "e-learning":
87-
// backgroundColor = "bg-eLearning_bg"; // Para la categoría 'ai'
88-
// break;
89-
// default:
90-
// backgroundColor = "bg-gray-600/50"; // Valor por defecto si no hay coincidencia
91-
// break;
92-
// }
93-
94-
// //si tiene más de una researchline le ponemos all al link a las publicaciones
95-
// let pubResearchLine = "all";
96-
// if (researchLine && researchLine.length == 1) {
97-
// pubResearchLine = researchLine[0];
98-
// }
99-
100-
// // PROJECT
101-
// return (
102-
// <CustomCard
103-
// className={
104-
// cn({ direction, className }) +
105-
// "hover:scale-[100%] bg-transparent border-transparent shadow-none border-b-gray-400 border-b-1 rounded-none py-6 flex flex-col items-start sm:flex-row gap-3 sm:gap-6"
106-
// }
107-
// >
108-
// <div
109-
// className={`w-full min-w-[184px] sm:w-1/2 h-[237px] bg-cover sm:bg-center ${backgroundColor} rounded-md `}
110-
// >
111-
// <Image
112-
// className="brightness-0 invert p-8"
113-
// src={logo}
114-
// fit="contain"
115-
// layout={"bottom-right"}
116-
// badgeVariant={"secondary"}
117-
// badgeSize={"md"}
118-
// badgeContent={t(`projects.type.${projectType}`)}
119-
// />
120-
// </div>
121-
122-
// <CardBody>
123-
// <CardContent className="gap-5 my-0.5 lg:mt-0 lg:gap-[22px]">
124-
// <div>
125-
// <CardTitle
126-
// level="h3"
127-
// className=" w-fit hover:text-blue-400 transition-all mb-0"
128-
// >
129-
// {title && (
130-
// <Link
131-
// href={route}
132-
// rel="noopener noreferrer"
133-
// target="_blank"
134-
// className={`flex flex-row w-fit gap-2 ${
135-
// title.length > 18 ? "items-start" : "items-center"
136-
// }`}
137-
// >
138-
// {title}{" "}
139-
// <ExternalLinkIcon
140-
// className="mt-1 flex-shrink-0"
141-
// width={24}
142-
// height={24}
143-
// />{" "}
144-
// </Link>
145-
// )}
146-
// </CardTitle>
147-
148-
// {description_translation && (
149-
// <CardDescription lines={3}>
150-
// {description_translation}
151-
// </CardDescription>
152-
// )}
153-
// </div>
154-
155-
// {/* <div className="flex flex-col items-start lg:flex-row gap-4 lg:gap-0 justify-between lg:items-end"> */}
156-
// <div className="BADGES-RESEARCHLINE flex flex-wrap gap-2">
157-
// {Array.isArray(researchLine)
158-
// ? researchLine.map((item, index) => {
159-
// // fondo researchline cards
160-
// let backgroundColorResearchLine;
161-
// let textColorResearchLine;
162-
163-
// // coge solo la primera researchline para ponerle el fondo
164-
// switch (item) {
165-
// case "data":
166-
// backgroundColorResearchLine = "bg-data-500"; // Para la categoría 'data'
167-
// break;
168-
// case "videoconference":
169-
// backgroundColorResearchLine = "bg-videoconference-500"; // Para la categoría 'videoconference'
170-
// break;
171-
// case "ai":
172-
// backgroundColorResearchLine = "bg-ai-700"; // Para la categoría 'ai'
173-
// // textColorResearchLine = "text-gray-900"
174-
// break;
175-
// case "computing":
176-
// backgroundColorResearchLine = "bg-networks-500"; // Para la categoría 'ai'
177-
// break;
178-
// case "e-learning":
179-
// backgroundColorResearchLine = "bg-eLearning-500"; // Para la categoría 'ai'
180-
// break;
181-
// default:
182-
// backgroundColorResearchLine = "bg-gray-500"; // Valor por defecto si no hay coincidencia
183-
// break;
184-
// }
185-
// return (
186-
// <Mybadge
187-
// className={` ${backgroundColorResearchLine} text-white ${textColorResearchLine} border-none tracking-widest`}
188-
// key={index}
189-
// variant="default"
190-
// size="lg"
191-
// >
192-
// {t(`projects.researchLines.${item}`)}
193-
// </Mybadge>
194-
// );
195-
// })
196-
// : null}
197-
// </div>
198-
// {/* <Button size="default" radius="rounded_sm" variant="outline" >
199-
// <Link href={`/research?researchline=${pubResearchLine}`}>
200-
// {t(`projects.card.button`)}
201-
// </Link>
202-
// </Button>
203-
// */}
204-
// {/* </div> */}
205-
// </CardContent>
206-
// </CardBody>
207-
// </CustomCard>
208-
// );
209-
// }
210-
// );
211-
212-
// Card.displayName = "ProjectCard";
213-
214-
// export default Card;
215-
216-
217-
2181
"use client";
2192

2203
import clsx from "clsx";
@@ -227,22 +10,32 @@ import { researchlines } from "@/constants/researchlines";
22710
import { Mybadge } from "../ui/mybadge";
22811
import { Button } from "../ui/button";
22912
import Image from "../ui/image";
230-
import { CustomCard, CardBody, CardContent, CardTitle, CardDescription } from "@/components/ui/customCard";
13+
import {
14+
CustomCard,
15+
CardBody,
16+
CardContent,
17+
CardTitle,
18+
CardDescription,
19+
} from "@/components/ui/customCard";
23120
import { ExternalLinkIcon } from "@radix-ui/react-icons";
23221

23322
const Card = React.forwardRef(
234-
({ title, description_en, description_es, img, route, researchLine, logo, projectType = "european-project" }, ref) => {
23+
(
24+
{
25+
title,
26+
description_en,
27+
description_es,
28+
img,
29+
route,
30+
researchLine,
31+
logo,
32+
projectType = "european-project",
33+
},
34+
ref
35+
) => {
23536
const { t, i18n } = useTranslation();
23637
const currentLang = i18n.language;
23738
const descriptionRef = useRef(null);
238-
const [isExpanded, setIsExpanded] = useState(false);
239-
const [isOverflowing, setIsOverflowing] = useState(false);
240-
241-
useEffect(() => {
242-
if (descriptionRef.current) {
243-
setIsOverflowing(descriptionRef.current.scrollHeight > descriptionRef.current.clientHeight);
244-
}
245-
}, [description_en, description_es]);
24639

24740
let description_translation = description_en;
24841
if (currentLang === "es" && description_es) {
@@ -262,32 +55,50 @@ const Card = React.forwardRef(
26255
}
26356

26457
return (
265-
<CustomCard className="bg-transparent border-transparent shadow-none border-b-gray-400 border-b-1 rounded-none py-6 flex flex-col items-start sm:flex-row gap-3 sm:gap-6">
266-
<div className={`w-full min-w-[184px] sm:w-1/2 h-[237px] bg-cover sm:bg-center ${backgroundColor} rounded-md`}>
267-
<Image className="brightness-0 invert p-8" src={logo} fit="contain" layout="bottom-right" badgeVariant="secondary" badgeSize="md" badgeContent={t(`projects.type.${projectType}`)} />
58+
<CustomCard className="py-6 flex flex-col items-start sm:flex-row gap-3 sm:gap-6 bg-transparent border-transparent shadow-none border-b-gray-400 border-b-1 rounded-none ">
59+
<div
60+
className={`w-full min-w-[184px] sm:w-1/2 h-[237px] bg-cover sm:bg-center ${backgroundColor} rounded-md`}
61+
>
62+
<Image
63+
className="brightness-0 invert p-8"
64+
src={logo}
65+
fit="contain"
66+
layout="bottom-right"
67+
badgeVariant="secondary"
68+
badgeSize="md"
69+
badgeContent={t(`projects.type.${projectType}`)}
70+
/>
26871
</div>
26972

27073
<CardBody>
27174
<CardContent className="gap-5 my-0.5 lg:mt-0 lg:gap-[22px]">
27275
<div>
273-
<CardTitle level="h3" className="w-fit hover:text-blue-400 transition-all mb-0">
76+
<CardTitle
77+
level="h3"
78+
className="w-fit hover:text-blue-400 transition-all mb-0"
79+
>
27480
{title && (
275-
<Link href={route} rel="noopener noreferrer" target="_blank" className="flex flex-row w-fit gap-2 items-center">
276-
{title} <ExternalLinkIcon className="mt-1 flex-shrink-0" width={24} height={24} />
81+
<Link
82+
href={route}
83+
rel="noopener noreferrer"
84+
target="_blank"
85+
className="flex flex-row w-fit gap-2 items-center"
86+
>
87+
{title}{" "}
88+
<ExternalLinkIcon
89+
className="mt-1 flex-shrink-0"
90+
width={24}
91+
height={24}
92+
/>
27793
</Link>
27894
)}
27995
</CardTitle>
28096

28197
{description_translation && (
282-
<CardDescription lines={isExpanded ? undefined : 3} ref={descriptionRef}>
98+
<CardDescription lines={4}>
28399
{description_translation}
284100
</CardDescription>
285101
)}
286-
{isOverflowing && (
287-
<Button onClick={() => setIsExpanded(!isExpanded)} variant="outline" size="sm" className="mt-2">
288-
{isExpanded ? t("projects.card.showLess") : t("projects.card.showMore")}
289-
</Button>
290-
)}
291102
</div>
292103

293104
<div className="BADGES-RESEARCHLINE flex flex-wrap gap-2">
@@ -301,7 +112,14 @@ const Card = React.forwardRef(
301112
"e-learning": "bg-eLearning-500",
302113
};
303114
return (
304-
<Mybadge key={index} className={`${colors[item] || "bg-gray-500"} text-white border-none tracking-widest`} variant="default" size="lg">
115+
<Mybadge
116+
key={index}
117+
className={`${
118+
colors[item] || "bg-gray-500"
119+
} text-white border-none tracking-widest`}
120+
variant="default"
121+
size="lg"
122+
>
305123
{t(`projects.researchLines.${item}`)}
306124
</Mybadge>
307125
);

components/cards/PublicationCard.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ const Card = React.forwardRef(
101101
// const publicationCard = (
102102
<CustomCard
103103
className={cn(
104-
" p-4 sm:py-4 whitespace-nowrap rounded-md font-body text-sm text-text bg-background-300 border-none shadow-md hover:scale-[101%] transition-all overflow-hidden" +
105-
" "
104+
" p-4 sm:py-4 whitespace-nowrap rounded-md font-body text-sm text-text bg-background-300 border-none shadow-md hover:scale-[101%] transition-all overflow-hidden"
106105
)}
107106
>
108107
<CardHeader className="flex flex-wrap">
@@ -207,7 +206,7 @@ const Card = React.forwardRef(
207206
</Button>
208207
) : null}
209208
</CardFooter>
210-
{/*
209+
{/*
211210
{console.log(date && date[0])} */}
212211
</CustomCard>
213212
);

components/cards/TeamCard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const Card = React.forwardRef(
4242
) => {
4343
const { t, i18n } = useTranslation();
4444
const [isExpanded, setIsExpanded] = useState(false);
45-
const currentLang = i18n.language;
45+
const currentLang = i18n.language;
4646

4747
// Elegir la descripción según el idioma
4848
const description_translation =

0 commit comments

Comments
 (0)