Skip to content

Commit

Permalink
Merge pull request #39 from Andrevile/feature/#28-PersonalProfile
Browse files Browse the repository at this point in the history
Feature/#28 personal profile
  • Loading branch information
Andrevile authored May 2, 2022
2 parents bcf2f43 + ba07540 commit a119a8c
Show file tree
Hide file tree
Showing 36 changed files with 26,772 additions and 245 deletions.
15 changes: 10 additions & 5 deletions pages/api/base.api.ts → apis/base.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,34 @@ export default class BaseAPI {
});

this.instance.interceptors.request.use((config: CustomAxiosRequestConfig) => {
if (config.isRequiredLogin) console.log('로그인 필수 기능');
if (config.isRequiredLogin) {
console.log('로그인 필수 기능');
config.headers[
'Authorization'
] = `Bearer "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NTEyMjkwODguMDQ3MjY3LCJleHAiOjE2NTE4MzM4ODguMDQ3MjY3LCJzb2NpYWxfaWQiOiIxMDc1MTg4NDkwMzk1ODQ2MTI2ODYifQ.JqVEYVlTvLB_8YYZBuWEe6fYO75xTZtA1PmMYOUAH_o"`;
}

return config;
});
}

protected async get(url: string, config?: CustomAxiosRequestConfig) {
const response = await this.instance.get(url, config);
return response;
return response.data;
}

protected async post(url: string, data?: unknown, config?: CustomAxiosRequestConfig) {
const response = await this.instance.post(url, data, config);
return response;
return response.data;
}

protected async put(url: string, data?: unknown, config?: CustomAxiosRequestConfig) {
const response = await this.instance.put(url, data, config);
return response;
return response.data;
}

protected async delete(url: string, data?: object, config?: CustomAxiosRequestConfig) {
const response = await this.instance.delete(url, { ...config, ...data });
return response;
return response.data;
}
}
4 changes: 2 additions & 2 deletions pages/api/type/index.ts → apis/type/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AxiosRequestConfig } from 'axios';

export interface CustomAxiosRequestConfig extends AxiosRequestConfig {
isRequiredLogin?: boolean;
}
isRequiredLogin?: boolean;
}
9 changes: 8 additions & 1 deletion pages/api/users.api.ts → apis/users.api.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import BaseAPI from './base.api';

import type { UserRegisterInfoType } from 'recoil/auth';

import { UserEditForm } from 'types/user';
import type { CustomAxiosRequestConfig } from './type';
class UsersAPI extends BaseAPI {
checkUserName(params: unknown) {
return this.get('/check_nickname', { params });
}
checkUsers(params: unknown) {
return this.get(`/${params}`);
}
registerUser(body: UserRegisterInfoType) {
// id값이 서버에서 발급 받은 token 값을 의미하는지?
return this.post(`/id`, body);
}
editUser(params: unknown, body: UserEditForm, config: CustomAxiosRequestConfig) {
return this.put(`/${params}`, body, config);
}
}

export default new UsersAPI('users');
24 changes: 24 additions & 0 deletions components/Profile/AddImage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

import ImageUploadWrapper from 'components/common/ImageUploadWrapper';
import { AddImageWrapper, AddImageSvg, AddImageText } from 'components/common/Atomic/AddItem';

interface Props {
editMode: boolean;
text: string;
}

const AddImage: React.FC<Props> = ({ editMode, text }) => {
return (
<AddImageWrapper editMode={editMode}>
<ImageUploadWrapper name="banner">
<div style={{ display: 'flex', flexDirection: 'column' }}>
<AddImageSvg priority width={80} height={80} />
<AddImageText>{text}</AddImageText>
</div>
</ImageUploadWrapper>
</AddImageWrapper>
);
};

export default AddImage;
21 changes: 0 additions & 21 deletions components/Profile/Banner/AddImage/index.tsx

This file was deleted.

16 changes: 6 additions & 10 deletions components/Profile/Banner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import React, { useState } from 'react';
import { useRecoilValue } from 'recoil';
import React from 'react';

import * as S from './styles';

import AddImage from './AddImage';

import { userRegisterInfoState, UserRegisterInfoType } from 'recoil/auth';

const Banner: React.FC = () => {
const [banner, setBanner] = useState<string>();

return <S.BannerWrapper url={banner}>{!banner && <AddImage text="프로필 배너를 추가 해주세요." />}</S.BannerWrapper>;
interface Props {
bannerImg: string;
}
const Banner: React.FC<Props> = ({ bannerImg, children }) => {
return <S.BannerWrapper url={bannerImg}>{children}</S.BannerWrapper>;
};

export default Banner;
2 changes: 1 addition & 1 deletion components/Profile/Banner/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { styledProps } from './types';
export const BannerWrapper = styled.div<styledProps>`
width: 100%;
height: 280px;
background-color: ${(props) => props.theme.color.backgroundGray};
background-color: ${(props) => props.theme.color.gray_200};
background-image: ${(props) => props.url && `url(${props.url})`};
background-repeat: no-repeat;
background-position: center;
Expand Down
2 changes: 1 addition & 1 deletion components/Profile/Banner/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DefaultTheme } from 'styled-components';

export interface styledProps {
url?: string | ArrayBuffer | null;
url?: string;
theme: DefaultTheme;
}
8 changes: 3 additions & 5 deletions components/Profile/ItemList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import AddItemCard from 'components/common/AddItemCard';
import Thumbnail from 'components/common/Thumbnail';
interface Props {
itemList: string[]; //데이터 형식에따라 타입 변환할 것
editMode?: boolean;
}
const ItemList: React.FC<Props> = ({ itemList }) => {
useEffect(() => {
console.log(itemList);
}, [itemList]);
const ItemList: React.FC<Props> = ({ itemList, editMode }) => {
return (
<S.ItemListWrapper>
{itemList.length ? (
itemList.map((item, i) => <Thumbnail key={i} item={item}></Thumbnail>)
itemList.map((item, i) => <Thumbnail key={i} item={item} editMode={editMode}></Thumbnail>)
) : (
<AddItemCard></AddItemCard>
)}
Expand Down
18 changes: 18 additions & 0 deletions components/Profile/ProfileEdit/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { ProfileEditButton } from 'components/common/Atomic/Tabs/Button';
import Image from 'next/image';

interface Props {
editMode: boolean;
editModeOnOff: (flag: boolean) => () => void;
}
const ProfileEdit: React.FC<Props> = ({ editMode, editModeOnOff }) => {
return (
<ProfileEditButton bgColor={editMode} onClick={editMode ? editModeOnOff(false) : editModeOnOff(true)}>
<Image src="/images/profile-edit.svg" width={24} height={24} />
<span>{editMode ? '수정 완료' : '프로필 수정'}</span>
</ProfileEditButton>
);
};

export default ProfileEdit;
13 changes: 13 additions & 0 deletions components/Profile/UploadProduct/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { UploadProductButton } from 'components/common/Atomic/Tabs/Button';
import Image from 'next/image';
const UploadProduct = () => {
return (
<UploadProductButton bgColor>
<Image src="/images/profile-edit-write2.svg" width={24} height={24} />
<span>작품 업로드</span>
</UploadProductButton>
);
};

export default UploadProduct;
89 changes: 0 additions & 89 deletions components/Profile/UserInfo/index.tsx

This file was deleted.

57 changes: 0 additions & 57 deletions components/Profile/UserInfo/styles.ts

This file was deleted.

14 changes: 14 additions & 0 deletions components/User/Following/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { FollowButton } from 'components/common/Atomic/Tabs/Button';
import Image from 'next/image';
import { following_icon } from 'constants/imgUrl';
const Following = () => {
return (
<FollowButton bgColor>
<Image src={following_icon} width={24} height={24} />
<span>팔로우</span>
</FollowButton>
);
};

export default Following;
14 changes: 14 additions & 0 deletions components/User/Message/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import Image from 'next/image';
import { MessageButton } from 'components/common/Atomic/Tabs/Button';
import { message_icon } from 'constants/imgUrl';
const Message = () => {
return (
<MessageButton>
<Image src={message_icon} width={24} height={24} />
<span>메시지</span>
</MessageButton>
);
};

export default Message;
Loading

0 comments on commit a119a8c

Please sign in to comment.