Skip to content

Commit

Permalink
update components
Browse files Browse the repository at this point in the history
  • Loading branch information
lee7198 committed Jan 19, 2024
1 parent 3f0981e commit d0920fb
Show file tree
Hide file tree
Showing 50 changed files with 48 additions and 91 deletions.
1 change: 0 additions & 1 deletion src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
createBrowserRouter,
redirect,
Expand Down
8 changes: 4 additions & 4 deletions src/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { TokenProviderType } from '@src/types/user';
import { InitUserType } from '@src/pages/Auth/components/Init/index.d';
import { NewProfileType } from '@src/pages/Mypage/index.d';
import { AuthType } from '@src/types/data';
import img0 from '../asset/images/profiles/initProfile0.png';
import img1 from '../asset/images/profiles/initProfile1.png';
import img2 from '../asset/images/profiles/initProfile2.png';
import img0 from '@src/asset/images/profiles/initProfile0.png';
import img1 from '@src/asset/images/profiles/initProfile1.png';
import img2 from '@src/asset/images/profiles/initProfile2.png';
import jigumeAxios from './axios';

const initProfiles = [img0, img1, img2];
Expand Down Expand Up @@ -56,7 +56,7 @@ export const handleRefreshToken = async (auth: AuthType) => {
*/
export const codeProvide = async (
code: string | null,
domain: string
domain?: string
): Promise<TokenProviderType> => {
/** @type {string} */
if (!code) throw Error('인가코드가 옳바르지 않습니다.');
Expand Down
1 change: 0 additions & 1 deletion src/components/InputWithNum.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { InputWithNumType } from '.';

export default function InputWithNum({
Expand Down
2 changes: 0 additions & 2 deletions src/components/LoadingButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function LoadingButton() {
return (
<button
Expand Down
2 changes: 0 additions & 2 deletions src/components/NextButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { on } from 'events';
import { NextButtnType } from '.';

export default function NextButton({
Expand Down
1 change: 0 additions & 1 deletion src/components/OpenGraphViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { OpenGraphViewerType } from '.';

export default function OpenGraphViewer({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from 'react';
import { StaticMap } from 'react-kakao-maps-sdk';
import { PositionType } from '@src/types/map';
import markerPin from '../../../../../asset/icon/markerPin.svg';
import markerPin from '@src/asset/icon/markerPin.svg';

export default function IntroStaticMap({
export default function StaticMapOnMarker({
img,
position,
}: {
img: string;
position: PositionType;
img?: string;
position?: PositionType;
}) {
return (
<div className="relative aspect-[1.9197] w-full rounded-xl bg-gray-300">
Expand Down Expand Up @@ -37,3 +36,8 @@ export default function IntroStaticMap({
</div>
);
}

StaticMapOnMarker.defaultProps = {
img: undefined,
position: undefined,
};
1 change: 0 additions & 1 deletion src/components/StyledCountInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import CurrencyInput from 'react-currency-input-field';
import { StyledCurrencyInputType } from '.';

Expand Down
1 change: 0 additions & 1 deletion src/components/StyledCurrencyInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import CurrencyInput from 'react-currency-input-field';
import { StyledCurrencyInputType } from '.';

Expand Down
1 change: 0 additions & 1 deletion src/components/StyledInputText.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { StyledInputTextType } from './index.d';

export default function StyledInputText({
Expand Down
1 change: 0 additions & 1 deletion src/components/StyledTextarea.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { StyledTextareaType } from '.';

export default function StyledTextarea({
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Announcement/components/Comments.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import SendIcon from '@src/asset/icon/SendIcon.svg';
import CommentsContent from './CommentsContent';
import SendIcon from '../../../asset/icon/SendIcon.svg';
// import SendIcon from '../../../../../asset/icon/SendIcon.svg';

export default function Comments() {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Announcement/components/CommentsContent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import addCommentIcon from '@src/asset/icon/addCommentIcon.svg';
import User from './User';
import CommentsText from './CommentsText';
import addCommentIcon from '../../../asset/icon/addCommentIcon.svg';

export default function CommentsContent() {
return (
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Announcement/components/CommentsInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import SendIcon from '../../../asset/icon/SendIcon.svg';
import SendIcon from '@src/asset/icon/SendIcon.svg';
// import SendIcon from '../../../../../asset/icon/SendIcon.svg';

export default function CommentsInput() {
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Announcement/components/CommentsText.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function CommentsText() {
return (
<div className="m-4 flex flex-row pl-12 pr-5 text-[14px]">
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Announcement/components/ProductAbout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import ItemComponent from '../../Map/components/BottomSheetComponent/components/ItemComponent';
import ItemComponent from '@src/pages/Map/components/BottomSheetComponent/components/ItemComponent';

export default function ProductAbout() {
return (
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Announcement/components/User.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react';
import Avatar from 'boring-avatars';
import {
primaryBlue,
primaryJade,
primaryPurple,
primaryYello,
} from '../../../common';
} from '@src/common';

const nickname = [
'jeju',
Expand Down
1 change: 0 additions & 1 deletion src/pages/Announcement/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import ProductAbout from './components/ProductAbout';
import CommentsContent from './components/CommentsContent';
import CommentsInput from './components/CommentsInput';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function CircularProgress() {
return (
<svg
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import Camera from '../../../../../asset/icon/initAccess/camera.svg';
import SaveArea from '../../../../../asset/icon/initAccess/saveArea.svg';
import Position from '../../../../../asset/icon/initAccess/position.svg';
import Camera from '@src/asset/icon/initAccess/camera.svg';
import SaveArea from '@src/asset/icon/initAccess/saveArea.svg';
import Position from '@src/asset/icon/initAccess/position.svg';

export default function InitAccessRights() {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Auth/components/Init/components/initAddress.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useEffect, useState } from 'react';
import { useNavigate, useOutletContext } from 'react-router-dom';
import DaumPostcodeEmbed, { Address } from 'react-daum-postcode';
import NextButton from '../../../../../components/NextButton';
import CloseIcon from '../../../../../asset/icon/CloseIcon.svg';
import NextButton from '@src/components/NextButton';
import CloseIcon from '@src/asset/icon/CloseIcon.svg';
import { InitContextType } from '../index.d';

export default function InitAddress() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useMutation } from 'react-query';
import { useNavigate, useOutletContext } from 'react-router-dom';
import { useRecoilState } from 'recoil';
import { AuthType } from '@src/types/data';
import { setNewUser } from '../../../../../api/user';
import { authState } from '../../../../../data';
import CameraIcon from '../../../../../asset/icon/mdi_camera.svg';
import { authState } from '@src/data';
import CameraIcon from '@src/asset/icon/mdi_camera.svg';
import { setNewUser } from '@src/api/user';
import { InitContextType } from '../index.d';

export default function InitProfileImage() {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Auth/components/Init/components/initUser.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect, useState } from 'react';
import { useOutletContext } from 'react-router-dom';
import { useMutation } from 'react-query';
import NextButton from '../../../../../components/NextButton';
import NextButton from '@src/components/NextButton';
import { checkNickname } from '@src/api/user';
import { handleTextFieldColor, validNickname } from '@src/utils';
import CircularProgress from './circularProgress';
import { checkNickname } from '../../../../../api/user';
import { handleTextFieldColor, validNickname } from '../../../../../utils';
import { InitContextType } from '../index.d';

export default function InitUser() {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Auth/components/Init/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { Outlet, useNavigate } from 'react-router-dom';
import ChevronLeft from '../../../../asset/icon/chevronLeft.svg';
import ChevronLeft from '@src/asset/icon/chevronLeft.svg';
import { InitUserType } from './index.d';

export default function Init() {
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Auth/components/Refresh/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import { useRecoilState } from 'recoil';
import { useQuery } from 'react-query';
import { Outlet } from 'react-router-dom';
import { AuthType, UserType } from '@src/types/data';
import { authState, initAuth, initUser, userState } from '../../../../data';
import { handleRefreshToken } from '../../../../api/user';
import { authState, initAuth, initUser, userState } from '@src/data';
import { handleRefreshToken } from '@src/api/user';

export default function Refresh() {
const [auth, setAuth] = useRecoilState<AuthType>(authState);
Expand Down
9 changes: 4 additions & 5 deletions src/pages/Auth/components/login.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import { useRecoilState } from 'recoil';
import { AuthType } from '@src/types/data';
import logo from '../../../asset/images/login/login_logo.png';
import kakaoImg from '../../../asset/images/login/kakao_login.png';
import naverImg from '../../../asset/images/login/naver_login.png';
import { authState } from '../../../data';
import logo from '@src/asset/images/login/login_logo.png';
import kakaoImg from '@src/asset/images/login/kakao_login.png';
import naverImg from '@src/asset/images/login/naver_login.png';
import { authState } from '@src/data';

export default function Login() {
const KAKAO_KEY = import.meta.env.VITE_KAKAO_REST_KEY;
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Auth/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { useQuery } from 'react-query';
import { useRecoilState } from 'recoil';
import { add } from 'date-fns';
import { AuthType } from '@src/types/data';
import { authState } from '@src/data';
import { codeProvide } from '@src/api/user';
import Loading from '../Map/components/Loading';
import { authState } from '../../data';
import { codeProvide } from '../../api/user';

export default function Auth() {
const navigate = useNavigate();
Expand Down
1 change: 0 additions & 1 deletion src/pages/Goods/components/CarouselBox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { Swiper, SwiperSlide } from 'swiper/react';
import { Pagination } from 'swiper/modules';

Expand Down
1 change: 0 additions & 1 deletion src/pages/Goods/components/IntroCategory.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import category from '../../Map/components/BottomSheetComponent/data';

export default function IntroCategory({ idx }: { idx: number }) {
Expand Down
17 changes: 10 additions & 7 deletions src/pages/Goods/components/PlaceInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react';
import { useQuery } from 'react-query';
import { GoodsPageDTO } from '@src/types/goods';
import { PositionType } from '@src/types/map';
import IntroStaticMap from './components/IntroStaticMap';
import IntroStaticMap from '@src/components/StaticMapOnMarker';

export default function PlaceInfo({
data,
Expand All @@ -12,9 +12,10 @@ export default function PlaceInfo({
const { kakao } = window;
const [address, setAddress] = useState('-');

const getAddress = (position: PositionType) => {
const getAddress = (position?: PositionType) => {
if (kakao === undefined) return;
if (!kakao.maps.services.Geocoder) return;
if (!position) return;

const geoCoder = new kakao.maps.services.Geocoder();
geoCoder.coord2Address(position.lng, position.lat, (result, status) => {
Expand All @@ -26,18 +27,20 @@ export default function PlaceInfo({
useQuery(
'revGeoCoder',
() =>
getAddress({
lat: data && data.address.mapY,
lng: data && data.address.mapX,
}),
getAddress(
data && {
lat: data.address.mapY,
lng: data.address.mapX,
}
),
{ retryDelay: 500, retry: 3 }
);

return (
<div className="flex flex-col gap-4 rounded-xl bg-gray-50 p-4">
<div className="relative aspect-[1.9197] w-full rounded-xl bg-gray-300">
<IntroStaticMap
img={data && data.goodsImagesList[0].goodsImgUrl}
img={data?.goodsImagesList[0].goodsImgUrl}
position={
data && {
lat: data.address.mapY,
Expand Down
1 change: 0 additions & 1 deletion src/pages/Goods/components/ProductContent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { GoodsPageDTO } from '@src/types/goods';
import React from 'react';

export default function ProductContent({
data,
Expand Down
1 change: 0 additions & 1 deletion src/pages/Goods/components/ProductInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useQuery } from 'react-query';
import { GoodsPageDTO } from '@src/types/goods';
import getOpenGraph from '../../../api/og';
Expand Down
1 change: 0 additions & 1 deletion src/pages/Goods/components/Submitted.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { motion } from 'framer-motion';
import { useLocation, useNavigate } from 'react-router-dom';
import submintted from '../../../asset/images/introduce/submitted.png';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { FilterType } from '../index.d';

export default function CategoryTag({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import NavigationIcon from '../../../../../asset/icon/NavigationIcon.svg';
import EditIcon from '../../../../../asset/icon/EditIcon.svg';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import Avatar from 'boring-avatars';
import { useNavigate } from 'react-router-dom';
import { GoodsPageDTO } from '@src/types/goods';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { GoodsPageDTO } from '@src/types/goods';
import { PreViewerMarker } from '@src/pages/Map/index.d';
import ItemComponent from './ItemComponent';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import LocationIcon from '../../../../../asset/icon/LocationIcon.svg';
import UserOutlineIcon from '../../../../../asset/icon/UserOutlineIcon.svg';
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Map/components/CurrentPoint.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function CurrentPoint() {
return (
<div className="flex size-[32px] items-center justify-center rounded-full bg-primaryBlue">
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Map/components/Loading.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function Loading({
onClick,
}: {
Expand Down
1 change: 0 additions & 1 deletion src/pages/Mypage/components/MyPageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import ChevronLeft from '../../../asset/icon/chevronLeft.svg';
import Notification from '../../../asset/icon/Notification.svg';
Expand Down
1 change: 0 additions & 1 deletion src/pages/Mypage/components/ProgressJoin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useQuery } from 'react-query';
import OpenGraphViewer from '../../../components/OpenGraphViewer';
import getOpenGraph from '../../../api/og';
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Mypage/components/ProgressLead.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function ProgressLead() {
return (
<div className="py-2">
Expand Down
1 change: 0 additions & 1 deletion src/pages/NotMatch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import logo from '../asset/images/login/login_logo.png';

Expand Down
1 change: 0 additions & 1 deletion src/pages/Register/components/Cost/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useOutletContext } from 'react-router-dom';
import { RegisterContextType } from '@src/types/register';
import StyledCurrencyInput from '../../../../components/StyledCurrencyInput';
Expand Down
1 change: 0 additions & 1 deletion src/pages/Register/components/Deadline/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useOutletContext } from 'react-router-dom';
import { RegisterContextType } from '@src/types/register';
import CalendarDate from './components/calendarDate';
Expand Down
Loading

0 comments on commit d0920fb

Please sign in to comment.