Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[마이페이지] style qa를 위한 변경 사항 #399

Merged
merged 15 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions public/svg/mypage_background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions src/assets/svg/MypageBackground.tsx

Large diffs are not rendered by default.

61 changes: 0 additions & 61 deletions src/assets/svg/MypageImage.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/assets/svg/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as MypageBackground } from './MypageBackground';
export { default as GradientCta } from './GradientCta';
export { default as HomeBackground } from './HomeBackground';
export { default as Step1 } from './Step1';
Expand Down Expand Up @@ -76,7 +77,6 @@ export { default as LongDivider } from './LongDivider';
export { default as Main03 } from './Main03';
export { default as Main04 } from './Main04';
export { default as Main02 } from './Main02';
export { default as MypageImage } from './MypageImage';
export { default as Person1 } from './Person1';
export { default as Person2 } from './Person2';
export { default as Person3 } from './Person3';
Expand Down
8 changes: 8 additions & 0 deletions src/components/CardRoom/CardRoom.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ export const WholeWrapper = styled.div`
z-index: 0;
`;

export const RoomImgWrapper = styled.img`
${({ theme: { mixin } }) => mixin.flexBox({})};
width: 100%;
height: 16rem;
overflow: hidden;
object-fit: cover;
`;

export const CardRoomWrapper = styled.div`
${({ theme: { mixin } }) => mixin.flexBox({ direction: 'column' })};

Expand Down
11 changes: 9 additions & 2 deletions src/components/CardRoom/DoneCardRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ interface DoneCardRoomType {
}

const DoneCardRoom = ({ user, srcImage, userCount, onClick }: DoneCardRoomType) => {
const multiline = user.length > 3 || (/[a-zA-Z]/.test(user) && user.length > 5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

글자수까지 신경 써주셨군요!👍

return (
<S.CardRoomWrapper onClick={onClick}>
<img src={srcImage} />
<S.RoomImgWrapper src={srcImage} />
<S.Text>
<S.User>{user}님</S.User>을 위한 선물방
{multiline ? (
<>
<S.User>{user}님</S.User>을 위한 선물방
</>
) : (
<S.User>{user}님을 위한 선물방</S.User>
)}
</S.Text>
<S.CountUser>
<IcUser style={{ width: '1.6rem', height: '1.6rem', color: '#ACA7A9' }} />
Expand Down
11 changes: 9 additions & 2 deletions src/components/CardRoom/EditCardRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,19 @@ const EditCardRoom = ({ user, srcImage, userCount, roomId, date, onClick }: Edit
const handleSettingIcon = () => {
navigate(`/editpage/${roomId}`);
};
const multiline = user.length > 3 || (/[a-zA-Z]/.test(user) && user.length > 5);
return (
<S.WholeWrapper>
<S.CardRoomWrapper onClick={onClick}>
<img src={srcImage} />
<S.RoomImgWrapper src={srcImage} />
<S.Text>
<S.User>{user}님</S.User>을 위한 선물방
{multiline ? (
<>
<S.User>{user}님</S.User>을 위한 선물방
</>
) : (
<S.User>{user}님을 위한 선물방</S.User>
)}
</S.Text>
<S.CountUser>
<IcUser
Expand Down
12 changes: 10 additions & 2 deletions src/components/CardRoom/ProgressCardRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ interface ProgressCardRoomType {

const ProgressCardRoom = ({ user, srcImage, userCount, date, onClick }: ProgressCardRoomType) => {
const isFuture = DateCheck({ date: date });
const multiline = user.length > 3 || (/[a-zA-Z]/.test(user) && user.length > 5);

return (
<S.CardRoomWrapper onClick={onClick}>
<img src={srcImage} />
<S.RoomImgWrapper src={srcImage} />
<S.Text>
<S.User>{user}님</S.User>을 위한 선물방
{multiline ? (
<>
<S.User>{user}님</S.User>을 위한 선물방
</>
) : (
<S.User>{user}님을 위한 선물방</S.User>
)}
</S.Text>
<S.CountUser>
<IcUser
Expand Down
2 changes: 0 additions & 2 deletions src/components/HomeMypageHeader/HomeMypageHeader.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ export const HomeMypageHeaderWrapper = styled.div`
position: fixed;
width: 100%;
height: 5.6rem;
gap: 1.6rem;
padding: 0 1.8rem;
z-index: 999;
top: 0rem;
background-color: #fafafa;
`;

export const UserProfileImg = styled.img`
Expand Down
19 changes: 17 additions & 2 deletions src/components/HomeMypageHeader/HomeMypageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { IcProfile, IcHome } from '../../assets/svg';
import { useNavigate } from 'react-router';
import * as S from './HomeMypageHeader.style';
import { useEffect, useState } from 'react';

const HomeMypageHeader = () => {
const navigate = useNavigate();
const userImg = localStorage.getItem('EXIT_USER_PROFILE_IMAGE');
const [isTop, setIsTop] = useState(true);

useEffect(() => {
const handleScroll = () => {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
setIsTop(scrollTop === 0);
};

window.addEventListener('scroll', handleScroll);

return () => {
window.removeEventListener('scroll', handleScroll);
};
}, []); // 처음 한 번만 실행

const handleMyPageIcon = () => {
navigate(`/mypage`);
Expand All @@ -14,8 +29,8 @@ const HomeMypageHeader = () => {
};

return (
<S.HomeMypageHeaderWrapper>
<IcHome style={{ width: '2.4rem' }} onClick={handleSettingHomeIcon} />
<S.HomeMypageHeaderWrapper style={{ backgroundColor: isTop ? 'transparent' : 'white' }}>
<IcHome style={{ width: '4.3rem' }} onClick={handleSettingHomeIcon} />
{userImg ? (
<S.UserProfileImg src={userImg} onClick={handleMyPageIcon} />
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/MyPage/EditRoom/EditRoom.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const TextWrapper = styled.div`

export const Text = styled.div`
${({ theme: { fonts } }) => fonts.heading_01};
> p {
> span {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 span태그로 바꾸신 이유가 뭔지 알 수 있을까요?? 지난 번 합숙 때 기본 p태그는 모바일에선 파란색인 것이라고 호은님께 배웠었는데, 혹시 그때문인지... 만약 이 이유로 바꾸신 것이라면 저도 바꿔야해서요!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

흠 그 부분을 상기시켜 한것은 아닙니다!
p태그는 기본적으로 엔터를 동반한 태그이기 때문에, 한 문장안에서 부분적으로 스타일 적용을 하기 위해선 p태그가 아닌 span를 활용해야겠다고 생각했기 때문입니다!

color: ${({ theme: { colors } }) => colors.P_06};
}
`;
4 changes: 3 additions & 1 deletion src/pages/MyPage/EditRoom/EditRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const EditRoom = () => {
<S.EditRoomWrapper>
<DetailHeader />
<S.TextWrapper>
<S.Text>{roomGifteeData?.gifterNumber || 0}명이</S.Text>
<S.Text>
<span>{roomGifteeData?.gifterNumber || 0}명</span>이
</S.Text>
<S.Text>{roomGifteeData?.gifteeName || ''}님을 위한</S.Text>
<S.Text>선물을 준비하고 있어요</S.Text>
</S.TextWrapper>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import styled from 'styled-components';

export const DoneGiftViewWrapper = styled.div`
display: flex;
flex-direction: column;
${({ theme: { mixin } }) => mixin.flexBox({ direction: 'column' })};
width: 100%;
`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import styled from 'styled-components';

export const ProgressGiftViewWrapper = styled.div`
display: flex;
flex-direction: column;
${({ theme: { mixin } }) => mixin.flexBox({ direction: 'column' })};
width: 100%;
`;

Expand Down
34 changes: 14 additions & 20 deletions src/pages/MyPage/MyPage.style.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
import styled from 'styled-components';
import BackgroundImage from '../../assets/img/mypage_background.png';
import { MypageBackground } from '../../assets/svg';

export const MyPageWrapper = styled.div`
display: flex;
flex-direction: column;
${({ theme: { mixin } }) => mixin.flexCenter({})};
width: 100%;
height: 100%;
`;

export const TopImage = styled.div`
export const TopImage = styled(MypageBackground)`
${({ theme: { mixin } }) => mixin.flexBox({})};
position: relative;
width: 37.5rem;
height: 34rem;
flex-shrink: 0;
top: 5rem;

background-image: url(${BackgroundImage});
background-size: contain;
z-index: 0;
margin: 0;
top: 0rem;
margin-bottom: 2rem;
`;
export const UserName = styled.div`
${({ theme: { mixin } }) => mixin.flexBox({ align: 'center' })};
${({ theme: { mixin } }) => mixin.flexBox({ align: 'center', justify: 'center' })};

${({ theme: { fonts } }) => fonts.heading_03};
> span {
color: ${({ theme: { colors } }) => colors.P_06};
}
`;
export const User = styled.div`
${({ theme: { fonts } }) => fonts.heading_01};
Expand All @@ -36,7 +31,6 @@ export const UserButtonWrapper = styled.div`
`;
export const UserWrapper = styled.div`
${({ theme: { mixin } }) => mixin.flexBox({ align: 'center' })};
width: 100%;
gap: 1.2rem;
`;
export const ProfileWrapper = styled.div`
Expand All @@ -50,8 +44,7 @@ export const ProfileWrapper = styled.div`
border: 1px solid rgba(255, 255, 255, 0.4);
padding: 0 1.6rem;
gap: 1.6rem;
top: 19rem;
left: 1.7rem;
top: 15rem;

z-index: 8;

Expand All @@ -62,15 +55,16 @@ export const GiftRoomWrapper = styled.div`
${({ theme: { mixin } }) =>
mixin.flexBox({ direction: 'column', align: 'center', justify: 'center' })};
background-color: white;
width: 100%;
position: relative;
top: -5rem;
top: -7rem;
padding-top: 4rem;
width: 37.5rem;
`;

export const NoneText = styled.div`
${({ theme: { mixin } }) => mixin.flexCenter({})};
height: 32.7rem;
width: 37.5rem;
color: ${({ theme: { colors } }) => colors.G_07};
${({ theme: { fonts } }) => fonts.body_07};
`;
6 changes: 5 additions & 1 deletion src/pages/MyPage/MyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ const MyPage = () => {
userName && userName.length > MAX_USERNAME_LENGTH
? `${userName.substring(0, MAX_USERNAME_LENGTH)}...`
: userName;
return <S.UserName>{translatedUserName}님</S.UserName>;
return (
<S.UserName>
<span>{translatedUserName} </span>님
</S.UserName>
);
};

return (
Expand Down