Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…IRVANA_Gidong into feat/notice/send
  • Loading branch information
imb96 committed Sep 25, 2023
2 parents 875b408 + 3c1be96 commit 2542a0d
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 46 deletions.
12 changes: 8 additions & 4 deletions src/components/Confirm/Confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface ConfirmProps {
nextPageLink: string;
CancelButton: React.ReactNode | (() => JSX.Element);
ConfirmButton: React.ReactNode | (() => JSX.Element);
linkState: { [key: string]: any };
linkState?: { [key: string]: any };
}

const Confirm = ({
Expand All @@ -31,7 +31,7 @@ const Confirm = ({
}: Partial<ConfirmProps>) => {
const [disabled, setDisabled] = useState(false);
const [domReady, setDomReady] = useState(false);

const FormedCancelButton =
typeof CancelButton === 'function' ? CancelButton() : CancelButton;
const FormedConfirmlButton =
Expand All @@ -53,9 +53,13 @@ const Confirm = ({
{content}
<NavButtonContainer>
<CancelButtonDefaultEvent onClick={() => setDisabled(true)}>
{CancelButton}
{FormedCancelButton}
</CancelButtonDefaultEvent>
<Link pageLink={nextPageLink}>{ConfirmButton}</Link>
<Link
state={linkState}
pageLink={nextPageLink}>
{FormedConfirmlButton}
</Link>
</NavButtonContainer>
</ContentContainer>
</StyledConfirmBackground>
Expand Down
7 changes: 5 additions & 2 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Link } from '../Link';
import { StyledFooter } from './Footer.style';
import useSessionStorage from '@hooks/useSessionStorage';
import { User } from '@/types/User';
import { useLocation } from 'react-router-dom';

export const Footer = () => {
const [userData] = useSessionStorage<Pick<User, '_id' | 'token'>>(
Expand All @@ -15,9 +16,10 @@ export const Footer = () => {

const iconInfos = [
{ name: 'home', size: 35, link: '/posts' },
{ name: 'self_improvement', size: 35, link: '/meditation' },
{ name: 'spa', size: 35, link: '/meditation' },
{ name: 'person', size: 35, link: `/profile/${userData._id}` }
];
const location = useLocation();

return (
<StyledFooter>
Expand All @@ -34,7 +36,8 @@ export const Footer = () => {
<Icon
name={icon.name}
size={icon.size}
color='black'
fill={icon.link === location.pathname}
color={icon.link === location.pathname ? 'purpleNormal' : 'black'}
/>
</Link>
))}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Icon/Icon.style.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import styled from '@emotion/styled';
import { color } from '@styles/colors';

export const StyledIcon = styled.span<{
size: number;
color: string;
color: keyof typeof color;
fill?: string;
}>`
color: ${({ theme, color }) => theme.color[color]};
Expand Down
5 changes: 3 additions & 2 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { StyledIcon } from './Icon.style';
import { GOOGLE_ICON_CLASSNAME } from '../../constants/Components';
import { GOOGLE_ICON_CLASSNAME } from '@constants/Components';
import { color } from '@styles/colors';

interface IconProps {
size: number;
name: string;
color: string;
color: keyof typeof color;
fill?: boolean;
}

Expand Down
6 changes: 5 additions & 1 deletion src/components/Link/Link.style.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { NavLink } from 'react-router-dom';
import { color } from '@styles/colors';
import styled from '@emotion/styled';

export const StyledNavLink = styled(NavLink)<{ size: number; color: string }>`
export const StyledNavLink = styled(NavLink)<{
size: number;
color: keyof typeof color;
}>`
color: ${({ theme, color }) => theme.color[color]};
font-size: ${({ size }) => size}px;
text-decoration: none;
Expand Down
5 changes: 3 additions & 2 deletions src/components/Link/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StyledNavLink } from './Link.style';
import { color } from '@styles/colors';

interface State {
[key: string]: any;
Expand All @@ -9,14 +10,14 @@ interface LinkProps {
pageLink: string;
size: number;
color: string;
state: State;
color: keyof typeof color;
}

const Link = ({
children,
pageLink,
size = 14,
color = '#000',
color = 'black',
state
}: Partial<LinkProps>) => {
return (
Expand Down
9 changes: 1 addition & 8 deletions src/pages/NotFound/NotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@ import {
ContentContainer,
NavButtonContainer
} from '@components/Alert/Alert.style';
import useSessionStorage from '@hooks/useSessionStorage';

const NotFound = () => {
const [user] = useSessionStorage('userData', {
_id: '',
token: ''
});
const redirectPage = user.token === '' ? '/' : '/posts';

return (
<LandingMain>
<StyledAlertBackground
Expand All @@ -25,7 +18,7 @@ const NotFound = () => {
<ContentContainer contentFontSize={16}>
{'404! 잘못된 페이지 접근이에요!'}
<NavButtonContainer>
<Link pageLink={redirectPage}>
<Link pageLink={'/'}>
<Button
width={300}
height={50}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/login/Login.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Logo = () => {
export const LoginContainer = styled.div`
${({ theme }) => theme.style.flexCenter};
flex-direction: column;
width: 100vw;
width: 100%;
height: 100vh;
background-image: url(${logo});
background: ${({ theme }) => theme.color.linearGradientPurple};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/password-update/PasswordUpdate.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Logo = styled.h1`
const PasswordUpdateContainer = styled.div`
${({ theme }) => theme.style.flexCenter};
flex-direction: column;
width: 100vw;
width: 100%;
height: calc(100vh - 64px);
background: ${({ theme }) => theme.color.linearGradientPurple};
`;
Expand Down
17 changes: 7 additions & 10 deletions src/pages/posting/Posting.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@ import styled from '@emotion/styled';
export const StyledPosting = styled.div`
width: 100%;
height: 100%;
${({ theme }) => theme.style.flexCenter}
background: ${({ theme }) => theme.color.linearGradientPurple};
`;

export const ContentContainer = styled.div`
width: 100%;
height: 550px;
${({ theme }) => theme.style.flexCenter};
height: 100%;
overflow-y: scroll;
${({ theme }) => theme.style.flexAlignCenter};
flex-direction: column;
`;

export const StyledDescription = styled.div`
width: 100%;
min-height: 130px;
${({ theme }) => theme.style.flexCenter};
flex-direction: column;
color: ${({ theme }) => theme.color.white};
margin-bottom: 20px;
> p {
font-size: 18px;
margin-bottom: 20px;
> b {
font-weight: 700;
}
font-size: 16px;
padding: 10px 0px;
}
`;
2 changes: 1 addition & 1 deletion src/pages/posting/Posting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Posting = () => {
if (location.state === null) {
navigate('/404');
}

console.log(location.state);
setMeditationInfo(location.state);
}, []);

Expand Down
4 changes: 3 additions & 1 deletion src/pages/posting/components/NewPost/NewPost.style.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from '@emotion/styled';

export const PostContainer = styled.div`
min-width: 330px;
min-width: 300px;
width: 80%;
height: 450px;
position: relative;
Expand Down Expand Up @@ -36,4 +36,6 @@ export const ButtonContainer = styled.div`
left: 50%;
transform: translateX(-50%);
bottom: 30px;
${({ theme }) => theme.style.flexCenter};
width: 90%;
`;
4 changes: 2 additions & 2 deletions src/pages/posting/components/SkipPosting/SkipPosting.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import styled from '@emotion/styled';
export const StyledSkipPosting = styled.div`
cursor: pointer;
${({ theme }) => theme.style.flexCenter};
height: 50px;
width: 100%;
min-height: 40px;
color: ${({ theme }) => theme.color.white};
font-size: 14px;
padding-top: 20px;
`;
2 changes: 1 addition & 1 deletion src/pages/posting/components/SkipPosting/SkipPosting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const SkipPosting = ({ channelId, customToken }: SkipPostingProps) => {

const handleClickSkipPost = () => {
setShowConfirm(true);
sessionStorage.removeItem('posting');
};

const handleCancelButton = () => {
Expand All @@ -29,6 +28,7 @@ const SkipPosting = ({ channelId, customToken }: SkipPostingProps) => {
const handleConfirmButton = async () => {
const formData = createFormData('', channelId);
await postCreateNewPost(customToken, formData).then(() => {
sessionStorage.removeItem('posting');
navigate('/posts');
});
};
Expand Down
19 changes: 11 additions & 8 deletions src/pages/profile/components/ProfileCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { PROFILE_TABS } from '../constants/profileTabs';
import { Follow } from '@/types/Follow';
import { PostPreview } from '@components/PostPreview';
import { Post } from '@/types/Post';
import { editPostData } from '@pages/posts/utils/editPostData';

interface ProfileCarouselProps {
tabItems: TabItems;
Expand All @@ -35,21 +36,23 @@ const ProfileCarousel = ({ tabItems, fullName }: ProfileCarouselProps) => {
{Object.entries(tabItems).map(([label, tabItem], index) => {
switch (label) {
case MEDITATION:
return tabItem.data && tabItem.data.length > 0 ? (
const editedData = editPostData(tabItem.data as Post[]);
return editedData && editedData.length > 0 ? (
<ProfileCarouselItem key={index}>
{tabItem.data &&
tabItem.data.map((post, index) => {
const { likes, comments } = post as Post;
return (
{editedData.map((post, index) => {
const { content, likes, comments } = post;
return (
content && (
<PostPreview
key={index}
post={post as Post}
post={post}
totalLikes={likes.length}
totalComments={comments.length}
noneProfile={true}
/>
);
})}
)
);
})}
</ProfileCarouselItem>
) : (
<ProfileCarouselItem key={index}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signup/signup.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const SignUpContainer = styled.div`
${({ theme }) => theme.style.flexCenter};
flex-direction: column;
width: 100vw;
width: 100%;
height: 100vh;
background-image: url(${logo});
background: ${({ theme }) => theme.color.linearGradientPurple};
Expand Down
1 change: 1 addition & 0 deletions src/styles/colors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const color = {
purpleNormal: '#8653ab',
purpleDark: '#47346d',
purpleDarker: '#272038',
purpleLight: '#b796d0',
Expand Down
1 change: 1 addition & 0 deletions src/styles/global.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const style = css`
width: 100%;
height: 100%;
max-width: 768px;
margin: 0 auto;
}
#modal-root {
position: absolute;
Expand Down

0 comments on commit 2542a0d

Please sign in to comment.