-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
변경이용
- Loading branch information
Showing
8 changed files
with
103 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useEffect, useState } from 'react'; | ||
import axios from '~/libs/axios'; | ||
import ProfileImg from '~/assets/images/Profile.png'; | ||
|
||
const useProfileImg = () => { | ||
const [profileImg, setProfileImg] = useState(ProfileImg); | ||
|
||
useEffect(() => { | ||
async function fetchData() { | ||
try { | ||
const res = await axios.get('/profile'); | ||
setProfileImg(`https://43.203.225.31.nip.io${res.data.profile_img}`); | ||
} catch (error) { | ||
console.log('에러'); | ||
} | ||
} | ||
fetchData(); | ||
}, []); | ||
|
||
return profileImg; | ||
}; | ||
|
||
export default useProfileImg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import styled from 'styled-components'; | ||
import theme from '../styles/theme'; | ||
|
||
interface SmallButtonProps { | ||
decline?: boolean; | ||
} | ||
|
||
const SmallButton = styled.button<SmallButtonProps>` | ||
background-color: ${({ decline }) => | ||
decline ? theme.colors.gray : theme.colors.orange}; | ||
color: ${theme.colors.white}; | ||
box-sizing: border-box; | ||
width: 50px; | ||
height: 20px; | ||
font-size: 10px; | ||
border-radius: 8px; | ||
border: none; | ||
margin-top: 2px; | ||
margin-right: 10px; | ||
&:hover, | ||
&:active { | ||
background-color: ${theme.colors.grayorange}; | ||
color: ${theme.colors.white}; | ||
} | ||
`; | ||
|
||
export default SmallButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
// TODO: 임시로 이 이미지만 넣어봅시다. 나중애 바꿔야해요. | ||
import { useEffect, useState } from 'react'; | ||
import styled from 'styled-components'; | ||
import axios from '~/libs/axios'; | ||
import ProfileImg from '~/assets/images/Profile.png'; | ||
|
||
const StyledProfileIcon = styled.div` | ||
background-image: url(${ProfileImg}); | ||
const ProfileIcon = () => { | ||
const [profileImg, setProfileImg] = useState(ProfileImg); | ||
|
||
useEffect(() => { | ||
async function fetchData() { | ||
try { | ||
const res = await axios.get('/profile'); | ||
setProfileImg(`https://43.203.225.31.nip.io${res.data.profile_img}`); | ||
} catch (error) { | ||
console.log('에러'); | ||
} | ||
} | ||
fetchData(); | ||
}, []); | ||
|
||
return <StyledProfileIcon profileImg={profileImg} />; | ||
}; | ||
|
||
export default ProfileIcon; | ||
|
||
const StyledProfileIcon = styled.div<{ profileImg: string }>` | ||
background-image: url(${({ profileImg }) => profileImg}); | ||
width: 24px; | ||
height: 24px; | ||
background-size: cover; /* 이미지가 div를 덮도록 설정 */ | ||
background-position: center; /* 이미지가 div의 중앙에 위치하도록 설정 */ | ||
outline: 0px solid ${({ theme }) => theme.colors.gray}; | ||
border-radius: 50%; | ||
`; | ||
|
||
const ProfileIcon = () => { | ||
return <StyledProfileIcon />; | ||
}; | ||
|
||
export default ProfileIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters