diff --git a/src/assets/heart-icons/heart-icon-black.svg b/src/assets/heart-icons/heart-icon-black.svg new file mode 100644 index 0000000..912e1d9 --- /dev/null +++ b/src/assets/heart-icons/heart-icon-black.svg @@ -0,0 +1,20 @@ + + + + diff --git a/src/assets/heart-icons/heart-icon-red.svg b/src/assets/heart-icons/heart-icon-red.svg new file mode 100644 index 0000000..7eedfdc --- /dev/null +++ b/src/assets/heart-icons/heart-icon-red.svg @@ -0,0 +1,20 @@ + + + + diff --git a/src/assets/heart-icons/heart-icon-white.svg b/src/assets/heart-icons/heart-icon-white.svg new file mode 100644 index 0000000..7c01e7a --- /dev/null +++ b/src/assets/heart-icons/heart-icon-white.svg @@ -0,0 +1,20 @@ + + + + diff --git a/src/features/posts/ArticleHeartIcon.jsx b/src/features/posts/ArticleHeartIcon.jsx index 8916fca..8096d9d 100644 --- a/src/features/posts/ArticleHeartIcon.jsx +++ b/src/features/posts/ArticleHeartIcon.jsx @@ -1,4 +1,13 @@ +import HeartIconBlack from "../../assets/heart-icons/heart-icon-black.svg"; +import HeartIconWhite from "../../assets/heart-icons/heart-icon-white.svg"; +import HeartIconRed from "../../assets/heart-icons/heart-icon-red.svg"; +import { useState } from "react"; +import { useEffect } from "react"; +import { useSelector } from "react-redux"; + const ArticleHeartIcon = ({ number, click, isLiked, addedLikes, hasChangedLikes }) => { + const theme = useSelector(state => state.global.theme); + const likedStyle = { color: "var(--heartColor)" } @@ -10,7 +19,8 @@ const ArticleHeartIcon = ({ number, click, isLiked, addedLikes, hasChangedLikes return(
- + {/* */} + heart icon

{number !== undefined ? number + addedLikes : "NaN"}

); diff --git a/src/features/posts/postsSlice.js b/src/features/posts/postsSlice.js index 0a4cf9f..a6620f8 100644 --- a/src/features/posts/postsSlice.js +++ b/src/features/posts/postsSlice.js @@ -61,6 +61,9 @@ const postsSlice = createSlice({ tempPosts[postIndex].addedLikes = action.payload.number; state.posts = tempPosts; + }, + unlikePosts: (state) => { + } }, extraReducers(builder) { diff --git a/src/features/profile/profileSlice.js b/src/features/profile/profileSlice.js index a756e5e..11d0ad8 100644 --- a/src/features/profile/profileSlice.js +++ b/src/features/profile/profileSlice.js @@ -102,6 +102,9 @@ const profileSlice = createSlice({ tempPosts[postIndex].addedLikes = action.payload.number; state.posts = tempPosts; + }, + unlikePosts: (state) => { + } }, extraReducers(builder) { diff --git a/src/index.css b/src/index.css index 07bb2ec..a93d442 100644 --- a/src/index.css +++ b/src/index.css @@ -596,12 +596,20 @@ input, textarea { padding: 1px 5px; border-radius: 5px; cursor: pointer; + align-items: center; +} + +.ArticleHeartIcon > img { + height: 14px; + opacity: 0.6; + /* mix-blend-mode: color-dodge; */ } .CommentsIcon { color: var(--black); margin-top: 15px; display: flex; + align-items: center; gap: 10px; /* background: var(--lightGray); */ padding: 1px 5px;