Skip to content

Commit

Permalink
♻️ Refactor: 파일 경로 변경 사항 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-paik committed Dec 3, 2023
1 parent 0103d59 commit e75876b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/components/Profile/ProfileCard/ProfileCard.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import useState from 'react';
import React, { useState } from 'react';
import styled from "styled-components";
import { useNavigate } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import Button from '../../common/Button/Button';
import ProfileFollow from './ProfileFollow';
import FollowCount from './FollowCount';
import { userInfoAtom } from '../../../atoms/UserAtom';
import { isDarkModeState } from '../../../atoms/StylesAtom';
import { postFollow, deleteFollow } from '../../../api/follow';
import basicProfile from '../../../assets/images/basic-profile-l.svg';
import basicDarkProfile from '../../../assets/images/basic-profile-l-dark.svg';
import { PATTERN } from '../../../constants/validation';

const ProfileCard = ({ userProfile, myProfile }) => {
const navigate = useNavigate();
const userInfo = useRecoilValue(userInfoAtom);
const account = userInfo.account;
const isDarkMode = useRecoilValue(isDarkModeState);
const [profile, setProfile] = useState(userProfile);
const numberRegex = /^https:\/\/api\.mandarin\.weniv\.co\.kr\/[/\w.]*$/;

const handleFollow = async (e) => {
const followResult = await postFollow(profile.accountname);
Expand All @@ -42,18 +42,18 @@ const ProfileCard = ({ userProfile, myProfile }) => {
return (
<Container>
<ProfileSection>
<ProfileFollow follow="Follower" userProfile={profile} />
<FollowCount followType="Followers" userProfile={profile} />
<Image
src={
numberRegex.test(userProfile.image)
PATTERN.PROFILEIMG.test(userProfile.image)
? userProfile.image
: isDarkMode
? basicDarkProfile
: basicProfile
}
alt="유저 이미지"
/>
<ProfileFollow follow="Follower" userProfile={profile} />
<FollowCount followType="Followings" userProfile={profile} />
</ProfileSection>
<UserSection>
<UserName>{userProfile.username}</UserName>
Expand Down Expand Up @@ -89,7 +89,7 @@ const ProfileCard = ({ userProfile, myProfile }) => {
)}
</ButtonSection>
<PostSection>
<Text>{userProfile.username}</Text>가 올린 글
<UserPost>{userProfile.username}</UserPost>가 올린 글
</PostSection>
</Container>
)
Expand All @@ -98,7 +98,7 @@ const ProfileCard = ({ userProfile, myProfile }) => {
export default ProfileCard;

const Container = styled.div`
background-color: ${({theme}) => theme.colors.backgroundColor};
background-color: ${({ theme }) => theme.colors.backgroundColor};
text-align: center;
`;

Expand Down Expand Up @@ -159,6 +159,6 @@ const PostSection = styled.section`
text-align: center;
`;

const Text = styled.strong`
color: ${({theme}) => theme.colors.mainColor};
const UserPost = styled.strong`
color: ${({ theme }) => theme.colors.mainColor};
`

0 comments on commit e75876b

Please sign in to comment.