Skip to content

Commit

Permalink
update styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Sokilskill committed Jun 10, 2024
1 parent 281218e commit 9e4bb64
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
21 changes: 12 additions & 9 deletions src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Flex } from "@chakra-ui/react";

import { Flex, Image, useBreakpointValue } from "@chakra-ui/react";
import { Animal } from "../../types";
import { CardImage } from "./CardImage";
import { useBreakpoint } from "../../hooks/useBreakpoint";
import { CardInfo } from "./CardInfo";
import { CardButton } from "./CardButton";

Expand All @@ -11,10 +8,12 @@ interface CardProps {
}

export const Card: React.FC<CardProps> = ({ item }) => {
const breakpoint = useBreakpoint();

const { imgLg, imgMob, name, age, description } = item;
const getImageSrc = breakpoint === "laptop" ? imgLg : imgMob;
const getImageSrc = useBreakpointValue({
base: imgMob,
md: imgLg,
lg: imgLg,
});

// форматування відображення віку
const formatAge = () => {
Expand All @@ -31,8 +30,12 @@ export const Card: React.FC<CardProps> = ({ item }) => {

return (
<>
<CardImage imgSrc={getImageSrc} altText={`Зображення ${description}`} />

<Image
src={getImageSrc}
alt={description}
h={{ base: "260px", lg: "350px" }}
w={{ lg: "370px" }}
/>
<Flex py="14px" justifyContent="space-between" alignItems="center">
<CardInfo name={name} ageText={formatAge()} />

Expand Down
10 changes: 0 additions & 10 deletions src/components/Card/CardImage.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion src/components/Sections/SectionChoose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const SectionChoose = () => {
{visibleAnimals.map(animal => (
<ListItem
key={animal.id}
w={{ base: "200px", sm: "223px", lg: "370px" }}
w={{ base: "200px", sm: "223px", md: "223px", lg: "370px" }}
h={{ base: "200px", sm: "223px", md: "384px", lg: "470px" }}
>
<Card item={animal} />
</ListItem>
Expand Down

0 comments on commit 9e4bb64

Please sign in to comment.