diff --git a/client/src/components/Headers/LoginHeader.tsx b/client/src/components/Headers/LoginHeader.tsx index 234dcc9f..afdcdb94 100644 --- a/client/src/components/Headers/LoginHeader.tsx +++ b/client/src/components/Headers/LoginHeader.tsx @@ -1,7 +1,7 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import styled from "styled-components"; import StockHolmLogo from "../../asset/images/StockHolmLogo.png"; -import SampleProfile from "../../asset/images/ProfileSample.png"; +// import SampleProfile from "../../asset/images/ProfileSample.png"; import { useNavigate } from "react-router-dom"; import ProfileModal from "../Profile/profileModal"; import StockSearchComponent from "./stockSearchComponent"; @@ -17,8 +17,18 @@ const LoginHeader: React.FC = () => { const dispatch = useDispatch(); // const { data: memberInfo } = useGetMemberInfo(); // use the hook here - const userName = memberInfo?.name; // retrieve the user's name - const userEmail = memberInfo?.email; // retrieve the user's email + // const userName = memberInfo?.name; // retrieve the user's name + // const userEmail = memberInfo?.email; // retrieve the user's email + + // πŸ”΄ ν”„λ‘œν•„μ— λ“€μ–΄κ°ˆ ν…μŠ€νŠΈ + const [profileText, setProfileText] = useState(""); + useEffect(() => { + if (memberInfo) { + const userEmail = memberInfo.email; + const firstText = userEmail.slice(0, 1); + setProfileText(firstText); + } + }, [memberInfo]); // ν”„λ‘œν•„ λͺ¨λ‹¬ μ—΄κΈ° ν•¨μˆ˜ const handleProfileOpen = () => { @@ -52,9 +62,10 @@ const LoginHeader: React.FC = () => { - {userName || userEmail} + {/* {userName || userEmail} */} - + {profileText} + {/* */} {isProfileModalOpen && } {logoutText} @@ -109,18 +120,43 @@ const UserActions = styled.div` align-items: center; `; -//μœ μ € 이름 μŠ€νƒ€μΌ -const UserNameDisplay = styled.span` - font-weight: 400; - font-size: 1rem; - color: darkslategray; - margin-right: 1rem; -`; +// //μœ μ € 이름 μŠ€νƒ€μΌ +// const UserNameDisplay = styled.span` +// font-weight: 400; +// font-size: 1rem; +// color: darkslategray; +// margin-right: 1rem; +// `; + +// // ν”„λ‘œν•„ λ²„νŠΌ μŠ€νƒ€μΌ +// const ProfileButton = styled.button` +// margin-right: 1rem; +// background-color: transparent; +// border: none; +// cursor: pointer; +// padding: 0; +// &:focus { +// outline: none; +// } +// &:hover { +// background-color: #f2f2f2; // light gray color on hover +// } +// `; // ν”„λ‘œν•„ λ²„νŠΌ μŠ€νƒ€μΌ const ProfileButton = styled.button` - margin-right: 1rem; - background-color: transparent; + width: 32px; + height: 32px; + display: flex; + justify-content: center; + align-items: center; + + border-radius: 50%; + margin-right: 0.75rem; + margin-top: 0.1rem; + + background-color: #274949; + color: white; border: none; cursor: pointer; padding: 0; @@ -128,15 +164,16 @@ const ProfileButton = styled.button` outline: none; } &:hover { - background-color: #f2f2f2; // light gray color on hover + background-color: #587878; // light gray color on hover } + transition: background-color 0.3s ease; `; -// ν”„λ‘œν•„ 이미지 μŠ€νƒ€μΌ -const ProfileImage = styled.img` - height: 35px; - width: auto; -`; +// // ν”„λ‘œν•„ 이미지 μŠ€νƒ€μΌ +// const ProfileImage = styled.img` +// height: 35px; +// width: auto; +// `; // λ‘œκ·Έμ•„μ›ƒ λ²„νŠΌ μŠ€νƒ€μΌ const LogoutButton = styled.button`