-
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.
Merge pull request #74 from ai-surfers/develop
24.12.28
- Loading branch information
Showing
6 changed files
with
145 additions
and
58 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,27 @@ | ||
import Button from "@/components/common/Button/Button"; | ||
import Icon from "@/components/common/Icon"; | ||
import Text from "@/components/common/Text/Text"; | ||
|
||
const GuideButton = () => { | ||
const handleOnGuide = () => { | ||
window.open( | ||
"https://pocket-prompt.notion.site/da477857a0cc44888b06dd23cf6682ff", | ||
"_blank" | ||
); | ||
}; | ||
return ( | ||
<Button | ||
onClick={handleOnGuide} | ||
size={36} | ||
hierarchy="normal" | ||
style={{ padding: "8px 8px 8px 12px" }} | ||
> | ||
<Text font="b3_14_semi " color="primary"> | ||
Guide | ||
</Text> | ||
<Icon name="Book" /> | ||
</Button> | ||
); | ||
}; | ||
|
||
export default GuideButton; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Button from "@/components/common/Button/Button"; | ||
import { useUser } from "@/hooks/useUser"; | ||
import { LOCALSTORAGE_KEYS, removeLocalStorage } from "@/utils/storageUtils"; | ||
import Text from "@/components/common/Text/Text"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
interface LogoutButtonProps { | ||
isUnderTablet: boolean; | ||
} | ||
|
||
const LogoutButton = ({ isUnderTablet }: LogoutButtonProps) => { | ||
const { resetUserState } = useUser(); | ||
const navigate = useNavigate(); | ||
|
||
function handleLogout() { | ||
removeLocalStorage(LOCALSTORAGE_KEYS.ACCESS_TOKEN); | ||
resetUserState(); | ||
navigate("/", { replace: true }); | ||
} | ||
return ( | ||
<Button | ||
hierarchy="default" | ||
size={isUnderTablet ? 44 : 36} | ||
style={{ justifyContent: "center" }} | ||
onClick={handleLogout} | ||
> | ||
<Text | ||
font={isUnderTablet ? "b3_14_med" : "b3_14_semi"} | ||
color="G_400" | ||
> | ||
로그아웃 | ||
</Text> | ||
</Button> | ||
); | ||
}; | ||
|
||
export default LogoutButton; |
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,54 +1,36 @@ | ||
import Button from "@/components/common/Button/Button"; | ||
import { useUser } from "@/hooks/useUser"; | ||
import { useNavigate } from "react-router-dom"; | ||
import styled from "styled-components"; | ||
import { LOCALSTORAGE_KEYS, removeLocalStorage } from "@/utils/storageUtils"; | ||
import Text from "@/components/common/Text/Text"; | ||
import Icon from "@/components/common/Icon"; | ||
|
||
export default function User() { | ||
const { userData, resetUserState } = useUser(); | ||
const { userData } = useUser(); | ||
const navigate = useNavigate(); | ||
|
||
function handleLogout() { | ||
removeLocalStorage(LOCALSTORAGE_KEYS.ACCESS_TOKEN); | ||
resetUserState(); | ||
navigate("/", { replace: true }); | ||
} | ||
|
||
return ( | ||
<UserContainer onClick={() => navigate("/my")}> | ||
<UserImage src={userData.user?.picture} /> | ||
<UserNickname>{userData.user?.nickname}</UserNickname> | ||
<Button | ||
hierarchy="default" | ||
size={36} | ||
style={{ justifyContent: "center" }} | ||
onClick={handleLogout} | ||
> | ||
<Text font="b3_14_semi" color="G_400"> | ||
로그아웃 | ||
<Wrapper onClick={() => navigate("/my")}> | ||
<UserWrapper> | ||
<Text font="b3_14_reg" color="G_800"> | ||
{userData.user?.nickname} | ||
</Text> | ||
</Button> | ||
</UserContainer> | ||
<Icon name="User" color="G_800" /> | ||
</UserWrapper> | ||
</Wrapper> | ||
); | ||
} | ||
|
||
const UserContainer = styled.div` | ||
const Wrapper = styled.div` | ||
${({ theme }) => theme.mixins.flexBox()}; | ||
gap: 10px; | ||
cursor: pointer; | ||
`; | ||
|
||
const UserImage = styled.img` | ||
width: 24px; | ||
height: 24px; | ||
border-radius: 50%; | ||
`; | ||
|
||
const UserNickname = styled.div` | ||
${({ theme }) => theme.fonts.body3}; | ||
${({ theme }) => theme.fonts.regular}; | ||
color: ${({ theme }) => theme.colors.black}; | ||
const UserWrapper = styled.div` | ||
${({ theme }) => theme.mixins.flexBox()}; | ||
padding: 8px 8px 8px 12px; | ||
gap: 10px; | ||
background-color: #f1f2f6; | ||
border-radius: 8px; | ||
`; |
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