fix: les resistants actuels sont en grayscale

proto-module-actu-react
Jalil Arfaoui 2023-08-31 18:41:05 +02:00
parent de691cd1e4
commit f8b3476489
4 changed files with 16 additions and 9 deletions

View File

@ -1,7 +1,8 @@
import { useNavigate } from "react-router";
import { isAncienResistant, Resistant } from "../../../Resistant";
import { Resistant } from "../../../Resistant";
import { getResistantPhotoUrl } from "../../../getResistantPhotoUrl";
import { Separator } from "../../../components/Separator";
import { getResistantGrayscaleRule } from "../../../style/getResistantGrayscaleRule";
interface Props {
resistant: Resistant;
@ -39,11 +40,9 @@ export const ResistantRow = ({ resistant }: Props) => {
src={getResistantPhotoUrl(resistant)}
alt={resistant.noms}
style={{
...getResistantGrayscaleRule(resistant),
width: "200px",
height: "200px",
filter: `grayscale(${
isAncienResistant(resistant) ? "80%" : "1"
})`,
}}
/>
</div>

View File

@ -4,6 +4,7 @@ import { isAncienResistant, Resistant } from "../../../Resistant";
import { getResistantPhotoUrl } from "../../../getResistantPhotoUrl";
import { HomeContext } from "../../../context/HomeContext";
import { getResistantPageUrl } from "../../../getResistantPageUrl";
import { getResistantGrayscaleRule } from "../../../style/getResistantGrayscaleRule";
export const PopupContent = ({ resistant }: { resistant: Resistant }) => {
const navigate = useNavigate();
@ -21,10 +22,10 @@ export const PopupContent = ({ resistant }: { resistant: Resistant }) => {
<img
src={getResistantPhotoUrl(resistant)}
style={{
...getResistantGrayscaleRule(resistant),
float: "left",
maxHeight: "15em",
marginRight: "1em",
filter: `grayscale(${isAncienResistant(resistant) ? "80%" : "1"})`,
}}
alt={resistant.noms}
/>

View File

@ -1,10 +1,11 @@
import { useNavigate } from "react-router";
import { BackgroundImage, Text } from "@mantine/core";
import { getResistantPhotoUrl } from "../../../getResistantPhotoUrl";
import { isAncienResistant, Resistant } from "../../../Resistant";
import { Resistant } from "../../../Resistant";
import React from "react";
import { HomeContext } from "../../../context/HomeContext";
import { getResistantPageUrl } from "../../../getResistantPageUrl";
import { getResistantGrayscaleRule } from "../../../style/getResistantGrayscaleRule";
interface Props {
resistant: Resistant;
@ -18,9 +19,7 @@ export const ResistantThumb = ({ resistant }: Props) => {
<BackgroundImage
src={getResistantPhotoUrl(resistant)}
className="resistant-thumb"
style={{
filter: `grayscale(${isAncienResistant(resistant) ? "80%" : "1"})`,
}}
style={getResistantGrayscaleRule(resistant)}
>
<div
className="thumb resistant-thumb"

View File

@ -0,0 +1,8 @@
import { isAncienResistant, Resistant } from "../Resistant";
import React from "react";
export const getResistantGrayscaleRule = (
resistant: Resistant
): React.CSSProperties => ({
filter: `grayscale(${isAncienResistant(resistant) ? "40%" : "0"})`,
});