From b118bd598178e3cca70347c6aeb084320b2c6159 Mon Sep 17 00:00:00 2001 From: divlo Date: Mon, 3 Aug 2020 12:21:35 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20FunctionCard:=20React.memo?= =?UTF-8?q?=20+=20=20instead=20of=20
?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/FunctionCard/FunctionCard.css | 2 ++ .../components/FunctionCard/FunctionCard.jsx | 33 +++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/website/components/FunctionCard/FunctionCard.css b/website/components/FunctionCard/FunctionCard.css index feddaa3..6c3c35d 100644 --- a/website/components/FunctionCard/FunctionCard.css +++ b/website/components/FunctionCard/FunctionCard.css @@ -10,6 +10,8 @@ margin: 0 0 50px 0; cursor: pointer; transition: all .3s; + color: var(--text-color); + text-decoration: none !important; } .FunctionCard__container { height: 100%; diff --git a/website/components/FunctionCard/FunctionCard.jsx b/website/components/FunctionCard/FunctionCard.jsx index cab8dca..6921bd6 100644 --- a/website/components/FunctionCard/FunctionCard.jsx +++ b/website/components/FunctionCard/FunctionCard.jsx @@ -1,11 +1,11 @@ import Link from 'next/link' -import { useState, forwardRef } from 'react' +import { useState, forwardRef, memo } from 'react' import date from 'date-and-time' import Loader from '../Loader' import { API_URL } from '../../utils/config/config' import './FunctionCard.css' -const FunctionCard = forwardRef((props, ref) => { +const FunctionCard = memo(forwardRef((props, ref) => { const [isLoading, setIsLoading] = useState(true) const handleLoad = () => { @@ -33,24 +33,23 @@ const FunctionCard = forwardRef((props, ref) => { } > {/* FunctionCard a une hauteur pendant chargement */} -
+ + {isLoading && } - {isLoading && } - -
-
- {props.title} -

{props.title}

-

{props.description}

+
+
+ {props.title} +

{props.title}

+

{props.description}

+
+
+

{props.categorie.name}

+

{date.format(new Date(props.createdAt), 'DD/MM/YYYY', true)}

+
-
-

{props.categorie.name}

-

{date.format(new Date(props.createdAt), 'DD/MM/YYYY', true)}

-
-
-
+
) -}) +})) export default FunctionCard