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

Fix : svg 파일 import 해놓기 #85

Merged
merged 1 commit into from
Jun 24, 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
5 changes: 3 additions & 2 deletions src/components/goods.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Link } from 'react-router-dom';
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';

const Goods = ({ data, isLoading, likeState, handleLikeChange, isArticleLikedByUser }) => {
return (
Expand All @@ -13,7 +14,7 @@ const Goods = ({ data, isLoading, likeState, handleLikeChange, isArticleLikedByU
{data.length > 0 ? (
data.map((item) => {
const isLiked = likeState[item.id] || isArticleLikedByUser(item.id);
const image = isLiked ? '/src/assets/images/icon/heart_fill.svg' : '/src/assets/images/icon/heart_blank.svg';
const image = isLiked ? HeartFill : HeartBlank;

return (
<Link key={item.id} className="goods-cont mb-7 px-2" to={`/post/${item.id}`}>
Expand Down
6 changes: 4 additions & 2 deletions src/components/myLocation/MyLocationComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useEffect, useRef, useState, useCallback } from 'react';
import { useEffect, useRef, useState, useCallback } from 'react';
import { Link, useLocation } from 'react-router-dom';
import {instance, auth} from '@api/index';
import useModalStore from "@zustand/modalStore";
import usemyprofileStore from "@zustand/myprofileStore";
import useAuthStore from "@zustand/authStore";
import searchStore from '../../zustand/searchStore';
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';

const MyLocationComponent = () => {
const {
Expand Down Expand Up @@ -188,7 +190,7 @@ const MyLocationComponent = () => {
</div>
}
<img
src={isArticleLikedByUser(item.id) ? '/src/assets/images/icon/heart_fill.svg' : '/src/assets/images/icon/heart_blank.svg'}
src={isArticleLikedByUser(item.id) ? HeartFill : HeartBlank}
alt='like'
className="absolute top-2 right-2"
onClick={ (e) => {
Expand Down
7 changes: 3 additions & 4 deletions src/components/post/ReadComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import useAuthStore from "@zustand/authStore.js";
import { instance } from "@api/index.js";
import useModalStore from "@zustand/modalStore.js";

import PostButton from "@components/post/PostButton.jsx";
import { Link } from "react-router-dom";
import { auth } from "@api/index.js";
import toast, { Toaster } from "react-hot-toast";
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';

function ReadComponent({ aid }) {
const tradeMethodMap = {
Expand Down Expand Up @@ -311,9 +312,7 @@ function ReadComponent({ aid }) {
>
<img
className="w-6 h-6"
src={`/src/assets/images/icon/${
liked ? "heart_fill.svg" : "heart_blank.svg"
}`}
src={liked ? HeartFill : HeartBlank}
alt={liked ? "좋아요 취소" : "좋아요"}
/>
<span className="text-black">{likeCount}</span>
Expand Down
6 changes: 4 additions & 2 deletions src/components/profile/BuyComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import {auth} from "@api/index"
import useModalStore from "@zustand/modalStore"
import usemyprofileStore from "@zustand/myprofileStore";
import { Link } from "react-router-dom";
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';


const BuyComponent = ({updateMyProfileInfo }) => {
Expand Down Expand Up @@ -147,7 +149,7 @@ const BuyComponent = ({updateMyProfileInfo }) => {
거래 완료
</div>
}
<img className="absolute top-2 right-2" src={`/src/assets/images/icon/${item.isLiked === true ? 'heart_fill.svg' : 'heart_blank.svg'}`} onClick={(e)=>{handleLikeChange(e,item.id)}}/>
<img className="absolute top-2 right-2" src={item.isLiked === true ? HeartFill : HeartBlank} onClick={(e)=>{handleLikeChange(e,item.id)}}/>
</div>
<p className="text-[16px] whitespace-nowrap text-ellipsis overflow-hidden font-bold mt-2 mb-1">{item.title}</p>
<div className="mb-1 flex text-sm gap-1 font-bold text-gray-400">
Expand Down
4 changes: 3 additions & 1 deletion src/components/profile/OfferComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import CLOTHES from "@/assets/images/clothes.png"
import useAuthStore from "@zustand/authStore"
import {auth} from "@api/index"
import useModalStore from "@zustand/modalStore"
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';


const OfferComponent = ({updateMyProfileInfo }) => {
Expand Down Expand Up @@ -127,7 +129,7 @@ const OfferComponent = ({updateMyProfileInfo }) => {
거래 완료
</div>
}
<img className="absolute top-2 right-2" src={`/src/assets/images/icon/${item.isLiked === true ? 'heart_fill.svg' : 'heart_blank.svg'}`} onClick={(e)=>{handleLikeChange(e,item.id)}}/>
<img className="absolute top-2 right-2" src={item.isLiked === true ? HeartFill : HeartBlank} onClick={(e)=>{handleLikeChange(e,item.id)}}/>
</div>
<p className="text-[16px] whitespace-nowrap text-ellipsis overflow-hidden font-bold mt-2 mb-1 pl-1">{item.title}</p>
<div className="mb-1 flex text-sm gap-1 font-bold text-gray-400 pl-1">
Expand Down
4 changes: 3 additions & 1 deletion src/components/profile/SaleComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import CLOTHES from "@/assets/images/clothes.png"
import useAuthStore from "@zustand/authStore"
import {auth, instance} from "@api/index"
import useModalStore from "@zustand/modalStore"
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';


const SaleComponent = ({userId}) => {
Expand Down Expand Up @@ -162,7 +164,7 @@ const SaleComponent = ({userId}) => {
</div>
}
{
item.isLiked == null ? '' : <img className="absolute top-2 right-2" src={`/src/assets/images/icon/${item.isLiked === true ? 'heart_fill.svg' : 'heart_blank.svg'}`} onClick={(e)=>{handleLikeChange(e,item.id)}}/>
item.isLiked == null ? '' : <img className="absolute top-2 right-2" src={item.isLiked === true ? HeartFill : HeartBlank} onClick={(e)=>{handleLikeChange(e,item.id)}}/>
}

</div>
Expand Down
4 changes: 3 additions & 1 deletion src/components/search/SearchArticleComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import useModalStore from "@zustand/modalStore"
import usemyprofileStore from "@zustand/myprofileStore"
import useAuthStore from "@zustand/authStore"
import searchStore from '../../zustand/searchStore';
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';

const SearchArticleComponent = () => {
const {
Expand Down Expand Up @@ -185,7 +187,7 @@ const SearchArticleComponent = () => {
</div>
}
<img
src={isArticleLikedByUser(item.id) ? '/src/assets/images/icon/heart_fill.svg' : '/src/assets/images/icon/heart_blank.svg'}
src={isArticleLikedByUser(item.id) ? HeartFill : HeartBlank}
alt='like'
className="absolute top-2 right-2"
onClick={ (e) => {
Expand Down
6 changes: 4 additions & 2 deletions src/pages/myLocation/MyLocation.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useEffect, useRef, useState, useCallback } from 'react';
import { useEffect, useRef, useState, useCallback } from 'react';
import filter from '@assets/images/icon/filter.svg';
import { Link, useLocation } from 'react-router-dom';
import {instance, auth} from '@api/index';
import useModalStore from "@zustand/modalStore"
import usemyprofileStore from "@zustand/myprofileStore"
import useAuthStore from "@zustand/authStore"
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';



Expand Down Expand Up @@ -488,7 +490,7 @@ const MyLocation = () => {
</div>
}
<img
src={isArticleLikedByUser(item.id) ? '/src/assets/images/icon/heart_fill.svg' : '/src/assets/images/icon/heart_blank.svg'}
src={isArticleLikedByUser(item.id) ? HeartFill : HeartBlank}
alt='like'
className="absolute top-2 right-2"
onClick={ (e) => {
Expand Down
6 changes: 4 additions & 2 deletions src/pages/search/Search.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useEffect, useRef, useState, useCallback } from 'react';
import { useEffect, useRef, useState, useCallback } from 'react';
import filter from '@assets/images/icon/filter.svg';
import { Link, useLocation } from 'react-router-dom';
import {instance, auth} from '@api/index';
import useModalStore from "@zustand/modalStore"
import usemyprofileStore from "@zustand/myprofileStore"
import useAuthStore from "@zustand/authStore"
import HeartBlank from '@assets/images/icon/heart_blank.svg';
import HeartFill from '@assets/images/icon/heart_fill.svg';



Expand Down Expand Up @@ -485,7 +487,7 @@ const Search = () => {
</div>
}
<img
src={isArticleLikedByUser(item.id) ? '/src/assets/images/icon/heart_fill.svg' : '/src/assets/images/icon/heart_blank.svg'}
src={isArticleLikedByUser(item.id) ? HeartFill : HeartBlank}
alt='like'
className="absolute top-2 right-2"
onClick={ (e) => {
Expand Down
Loading