Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[# 257] svg 이미지로 불러오던 방식 rollback #259

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/components/main/MyPlantAlimCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MyPlantAlimCheck: React.FC<MyPlantAlimCheckProps> = ({ plants }) => {
});
}, [api]);

const { icon, left, right } = useMemo(() => getRandomIllustrator(), []);
const { Icon, left, right } = useMemo(() => getRandomIllustrator(), []);

return (
<Carousel setApi={setApi}>
Expand All @@ -41,15 +41,10 @@ const MyPlantAlimCheck: React.FC<MyPlantAlimCheckProps> = ({ plants }) => {
{plants.map((plant) => (
<CarouselItem key={plant.myPlantId}>
<div className="flex flex-col items-center justify-center">
<img
alt={'내 식물 일러스트 아이콘'}
src={icon}
loading={'lazy'}
<Icon
style={{
transform: `translateY(-20px) translateX(${(-1 * (left - right)) / 2 - 3}px)`,
}}
width={210}
height={234}
className={cn('mt-[10px] mb-[30px]')}
/>
<div className="flex flex-col items-center justify-center">
Expand Down
40 changes: 20 additions & 20 deletions src/utils/home/getRandomIllustrator.ts
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
/// <reference types="vite-plugin-svgr/client" />
import PlantIcon1 from '@/assets/icon/plants/1.svg';
import PlantIcon2 from '@/assets/icon/plants/2.svg';
import PlantIcon3 from '@/assets/icon/plants/3.svg';
import PlantIcon4 from '@/assets/icon/plants/4.svg';
import PlantIcon5 from '@/assets/icon/plants/5.svg';
import PlantIcon6 from '@/assets/icon/plants/6.svg';
import PlantIcon7 from '@/assets/icon/plants/7.svg';
import PlantIcon8 from '@/assets/icon/plants/8.svg';
import PlantIcon9 from '@/assets/icon/plants/9.svg';
import PlantIcon10 from '@/assets/icon/plants/10.svg';
import PlantIcon1 from '@/assets/icon/plants/1.svg?react';
import PlantIcon2 from '@/assets/icon/plants/2.svg?react';
import PlantIcon3 from '@/assets/icon/plants/3.svg?react';
import PlantIcon4 from '@/assets/icon/plants/4.svg?react';
import PlantIcon5 from '@/assets/icon/plants/5.svg?react';
import PlantIcon6 from '@/assets/icon/plants/6.svg?react';
import PlantIcon7 from '@/assets/icon/plants/7.svg?react';
import PlantIcon8 from '@/assets/icon/plants/8.svg?react';
import PlantIcon9 from '@/assets/icon/plants/9.svg?react';
import PlantIcon10 from '@/assets/icon/plants/10.svg?react';
import { random } from 'es-toolkit';

const illustrators = [
{
icon: PlantIcon1,
Icon: PlantIcon1,
left: 71.74,
right: 68.5,
},
{
icon: PlantIcon2,
Icon: PlantIcon2,
left: 68.62,
right: 67.84,
},
{
icon: PlantIcon3,
Icon: PlantIcon3,
left: 73.72,
right: 62.74,
},
{
icon: PlantIcon4,
Icon: PlantIcon4,
left: 83.83,
right: 52.63,
},
{
icon: PlantIcon5,
Icon: PlantIcon5,
left: 69.82,
right: 66.84,
},
{
icon: PlantIcon6,
Icon: PlantIcon6,
left: 52.68,
right: 83.78,
},
{
icon: PlantIcon7,
Icon: PlantIcon7,
left: 65.97,
right: 71.65,
},
{
icon: PlantIcon8,
Icon: PlantIcon8,
left: 58.61,
right: 77.85,
},
{
icon: PlantIcon9,
Icon: PlantIcon9,
left: 65.23,
right: 71.24,
},
{
icon: PlantIcon10,
Icon: PlantIcon10,
left: 74.53,
right: 62.25,
},
Expand Down
Loading