Skip to content

Commit

Permalink
Merge pull request #352 from Chaem03/feature/#349
Browse files Browse the repository at this point in the history
🎨 Design: 디자인 스타클리어페이지 수정
  • Loading branch information
Chaem03 authored Aug 5, 2024
2 parents 51a99e3 + ebbfa8d commit 84a73c4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/components/common/Header/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const Header = styled.div`
z-index: 2;
padding: ${(props) => props.$padding};
margin: ${(props) => props.$margin};
cursor: pointer;
color: ${(props) => props.color || "initial"};
`;

Expand Down
25 changes: 9 additions & 16 deletions src/pages/MyPage/MyPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ import { Logout } from "../../components/Logout/Logout";
import Modal from "../../components/Modal/Modal";
import LOGO from "../../assets/images/MainLogoImg.svg";
import { useMyInfo } from "../../hooks/useMyInfo";
import WrapperContent from "../../components/PrivacyContent/PrivacyContent";
import ChangeRoutine from "../../components/RoutineChange/RoutineChange";
import { AgreePage } from "@/pages/AgreePage/AgreePage";
import { useNavigate } from "react-router-dom";
const MyPage = () => {
const { myinfo } = useMyInfo();
const [isLogoutVisible, setIsLogoutVisible] = useState(false);
const [isSubscribeVisible, setIsSubscribeVisible] = useState(false);
const [isPrivacyVisible, setIsPrivacyVisible] = useState(false);
const [selectedContent, setSelectedContent] = useState(null);

const [routineVisible, setRoutineVisible] = useState(false);
const navigate = useNavigate();
const myData = myinfo?.data || null;
Expand All @@ -29,18 +26,20 @@ const MyPage = () => {
const handleCloseModal = () => {
setIsLogoutVisible(false);
setIsSubscribeVisible(false);
setIsPrivacyVisible(false);
};

const handleLogoutClick = () => setIsLogoutVisible(true);
const handleSubscribeClick = () => setIsSubscribeVisible(true);
const handlePrivacyClick = () => {
return <AgreePage />;
};

const handlePrivacyClick = (text) => {
if (text === "이용약관") {
navigate("/agree/0");
} else {
navigate("/agree/1");
}
};
const handleRoutineChangeClick = () => setRoutineVisible(true);

const handleBackBtnClick = () => setIsPrivacyVisible(false);
const favoriteStars = myData.celebs.filter(
(item) => item.routines_added_count > 0
);
Expand All @@ -51,13 +50,7 @@ const MyPage = () => {
};
return (
<>
{isPrivacyVisible ? (
<WrapperContent
selectedText={selectedContent}
onBackBtnClick={handleBackBtnClick}
contentsNumber={selectedContent === "이용약관" ? "0" : "1"}
/>
) : routineVisible ? (
{routineVisible ? (
<ChangeRoutine onCategoriesUpdate={handleCategoriesUpdate} />
) : (
<>
Expand Down
10 changes: 5 additions & 5 deletions src/pages/SearchPage/SearchResultP.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Header } from "@/components/common/Header/Header";
export const SearchResultP = () => {
const { data } = useParams();
const [searchData, setSearchData] = useState({});
const navigate = useNavigate();
const getSearchData = async () => {
const search = await getSearchContent(data);
setSearchData(search.data);
Expand All @@ -18,7 +19,6 @@ export const SearchResultP = () => {
getSearchData();
}, [data]);
console.log("data:", data);
const navigate = useNavigate();

const filteredKeys = Object.keys(searchData);

Expand All @@ -33,11 +33,11 @@ export const SearchResultP = () => {
const handleClick = (id, type) => {
let url = "";
switch (type) {
case "celeb":
case "routine":
case "인물":
case "루틴":
url = `/star/${id}`;
break;
case "theme":
case "테마":
url = `/theme/${id}`;
break;
default:
Expand All @@ -64,7 +64,7 @@ export const SearchResultP = () => {
name={item.title}
profession={item.profession}
type={key}
onClick={handleClick}
onClick={() => handleClick(item.id, key)}
/>
))}
</S.CategoryWrapper>
Expand Down
3 changes: 0 additions & 3 deletions src/pages/StarPage/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ export const shareBtn = styled.button`
gap: 10px;
flex-shrink: 0;
text-align: center;
border-radius: 15px;
border: 1px solid #c4d9e2;
background: rgba(196, 217, 226, 0.5);
}
`;
export const shareContainr = styled.div`
Expand Down
7 changes: 6 additions & 1 deletion src/pages/SubCategoryPage/SubCategoryPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const SubCategoryPage = () => {
const moveOnSearch = () => {
navigate("/search");
};

const moveOnStarP = (id) => {
navigate(`/star/${id}`);
};
return (
<S.Layout>
<Header $margin={"1rem 0 0 0"} $padding={"1rem 1rem 0 1rem"}>
Expand All @@ -48,7 +52,8 @@ const SubCategoryPage = () => {
src={item.image}
name={item.title}
profession={item.profession}
type={"celeb"}
type={인물}
onClick={() => moveOnStarP(item.url)}
/>
))}
</S.CategoryWrapper>
Expand Down

0 comments on commit 84a73c4

Please sign in to comment.