@@ -6,6 +6,7 @@ import { ChangeEvent, FocusEvent, useRef, useState } from 'react';
6
6
import { useShallow } from 'zustand/shallow' ;
7
7
8
8
import CameraIcon from '@/assets/icons/CameraIcon.svg' ;
9
+ import MyListLoading from '@/components/feature/myProfile/MyListLoading' ;
9
10
import ButtonDefault from '@/components/ui/ButtonDefault' ;
10
11
import UserThumbnail from '@/components/ui/UserThumbnail' ;
11
12
import { DEFAULT_PROFILE_IMG_URL } from '@/constants' ;
@@ -104,60 +105,64 @@ const MyprofileSidebar = () => {
104
105
setIsSameNickname ( isSame ) ;
105
106
} ;
106
107
107
- if ( ! user ) return null ;
108
-
109
108
return (
110
109
< article className = 'p-5 border border-gray-300 bg-white rounded-2xl shadow-[0_2px_20px_rgba(0,0,0,0.04)] md:px-10 md:pt-[23px] md:pb-[30px] lg:w-[280px] lg:shrink-0 lg:px-5 lg:py-[39px]' >
111
- < div className = 'flex items-center gap-4 md:items-start md:gap-8 lg:flex-col lg:items-center' >
112
- < div className = 'relative' >
113
- < UserThumbnail
114
- imgSrc = { user . image }
115
- userName = { user . nickname }
116
- className = 'md:w-20 lg:w-[164px]'
117
- />
118
- < input
119
- type = 'file'
120
- name = 'imgFileUpload'
121
- id = 'imgFileUpload'
122
- accept = 'image/*'
123
- className = 'hidden'
124
- onChange = { handleUploadImage }
125
- ref = { fileRef }
126
- />
127
- < label
128
- htmlFor = 'imgFileUpload'
129
- className = 'absolute top-[65%] left-[65%] w-[40%] p-1 flex items-center justify-center bg-primary rounded-full cursor-pointer lg:top-0 lg:left-0 lg:w-full lg:h-full lg:bg-primary/30 lg:opacity-0 lg:hover:opacity-100 lg:transition-opacity'
130
- >
131
- < CameraIcon className = 'text-white w-[100%] h-[100%] lg:w-10 lg:h-10' />
132
- </ label >
133
- { isUploading && (
134
- < div className = 'absolute top-0 left-0 w-full h-full flex items-center justify-center' >
135
- < div className = ' w-8 h-8 border-4 mb-4 border-gray-300 border-t-primary rounded-full animate-spin' />
110
+ { ! user ? (
111
+ < MyListLoading />
112
+ ) : (
113
+ < >
114
+ < div className = 'flex items-center gap-4 md:items-start md:gap-8 lg:flex-col lg:items-center' >
115
+ < div className = 'relative' >
116
+ < UserThumbnail
117
+ imgSrc = { user . image }
118
+ userName = { user . nickname }
119
+ className = 'md:w-20 lg:w-[164px]'
120
+ />
121
+ < input
122
+ type = 'file'
123
+ name = 'imgFileUpload'
124
+ id = 'imgFileUpload'
125
+ accept = 'image/*'
126
+ className = 'hidden'
127
+ onChange = { handleUploadImage }
128
+ ref = { fileRef }
129
+ />
130
+ < label
131
+ htmlFor = 'imgFileUpload'
132
+ className = 'absolute top-[65%] left-[65%] w-[40%] p-1 flex items-center justify-center bg-primary rounded-full cursor-pointer lg:top-0 lg:left-0 lg:w-full lg:h-full lg:bg-primary/30 lg:opacity-0 lg:hover:opacity-100 lg:transition-opacity'
133
+ >
134
+ < CameraIcon className = 'text-white w-[100%] h-[100%] lg:w-10 lg:h-10' />
135
+ </ label >
136
+ { isUploading && (
137
+ < div className = 'absolute top-0 left-0 w-full h-full flex items-center justify-center' >
138
+ < div className = ' w-8 h-8 border-4 mb-4 border-gray-300 border-t-primary rounded-full animate-spin' />
139
+ </ div >
140
+ ) }
136
141
</ div >
137
- ) }
138
- </ div >
139
- < span className = 'grow text-xl font-bold md:pt-[7px] md:text-2xl lg:pt-0 lg:min-h-[74px] lg:text-center' >
140
- { user . nickname }
141
- </ span >
142
- </ div >
143
- < div className = 'mt-5 md:flex md:flex-wrap md:mt-[30px] lg:mt-[48px]' >
144
- < span className = 'block mb-2 text-md font-medium md:w-full md:mb-[10px] md:shrink md:text-base' >
145
- 닉네임
146
- </ span >
147
- < Input
148
- placeholder = { user . nickname }
149
- className = 'input h-[42px] py-[9px] mb-1.5 border-gray-300 shadow-none md:grow md:shrink md:basis-0 md:h-[48px] md:py-[11px] md:mb-0 md:mr-6 lg:grow-0 lg:shrink-0 lg:basis-full lg:mr-0 lg:mb-2'
150
- ref = { nicknameRef }
151
- onBlur = { checkSameNickname }
152
- />
153
- < ButtonDefault
154
- onClick = { handleUpdateNickname }
155
- disabled = { isSameNickname }
156
- className = 'w-[89px] h-[42px] py-0 px-0 ml-auto text-md font-bold rounded-xl md:w-[116px] md:h-[48px] md:text-base lg:w-[96px] lg:h-[42px]'
157
- >
158
- 변경하기
159
- </ ButtonDefault >
160
- </ div >
142
+ < span className = 'grow text-xl font-bold md:pt-[7px] md:text-2xl lg:pt-0 lg:min-h-[74px] lg:text-center' >
143
+ { user . nickname }
144
+ </ span >
145
+ </ div >
146
+ < div className = 'mt-5 md:flex md:flex-wrap md:mt-[30px] lg:mt-[48px]' >
147
+ < span className = 'block mb-2 text-md font-medium md:w-full md:mb-[10px] md:shrink md:text-base' >
148
+ 닉네임
149
+ </ span >
150
+ < Input
151
+ placeholder = { user . nickname }
152
+ className = 'input h-[42px] py-[9px] mb-1.5 border-gray-300 shadow-none md:grow md:shrink md:basis-0 md:h-[48px] md:py-[11px] md:mb-0 md:mr-6 lg:grow-0 lg:shrink-0 lg:basis-full lg:mr-0 lg:mb-2'
153
+ ref = { nicknameRef }
154
+ onBlur = { checkSameNickname }
155
+ />
156
+ < ButtonDefault
157
+ onClick = { handleUpdateNickname }
158
+ disabled = { isSameNickname }
159
+ className = 'w-[89px] h-[42px] py-0 px-0 ml-auto text-md font-bold rounded-xl md:w-[116px] md:h-[48px] md:text-base lg:w-[96px] lg:h-[42px]'
160
+ >
161
+ 변경하기
162
+ </ ButtonDefault >
163
+ </ div >
164
+ </ >
165
+ ) }
161
166
</ article >
162
167
) ;
163
168
} ;
0 commit comments