Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c38b8db
:lipstick: design: semantic negative hex 변경
ccconac Sep 22, 2024
15733b4
:sparkles: feat: useTheme custom hook 구현
ccconac Sep 22, 2024
2cd9aee
:sparkles: feat: 설정 페이지 다크 모드 구현
ccconac Sep 22, 2024
ef49686
:fire: remove: 불필요한 스타일 props 삭제
ccconac Sep 22, 2024
18a7af6
✨ feat: 소개 페이지 다크 모드 구현
ccconac Sep 23, 2024
9423e0f
:sparkles: feat: 마이 페이지 다크 모드 구현
ccconac Sep 23, 2024
f4e628f
:sparkles: feat: header component 다크 모드 구현
ccconac Sep 23, 2024
32aa31e
:hammer: fix: layout theme provider 적용 및 불필요한 코드 제거
ccconac Sep 23, 2024
48f083e
:fire: remove: 소개 페이지 불필요한 코드 제거
ccconac Sep 23, 2024
801de85
:sparkles: feat: 공유 페이지 다크 모드 구현
ccconac Sep 23, 2024
46f9dfc
:sparkles: feat: 메인 페이지 다크 모드 구현
ccconac Sep 23, 2024
2c8649b
:sparkles: feat: 작성 페이지 다크 모드 구현
ccconac Sep 23, 2024
8918de2
:sparkles: feat: 상세 페이지 다크 모드 구현
ccconac Sep 23, 2024
f0f05e6
:sparkles: feat: 수정 페이지 컨테이너 추가
ccconac Sep 23, 2024
0604ade
:sparkles: feat: 설정 페이지 테마 변경 체크 아이콘 추가 및 useTheme 수정
ccconac Sep 23, 2024
946064d
:hammer: fix: import 구문 수정
ccconac Sep 23, 2024
e7d9ef7
:hammer: fix: 대소문자 구분이 되지 않은 import 구문 수정
ccconac Sep 23, 2024
b951ca7
:hammer: fix: 서버 로컬에서 배포 도메인으로 변경
ccconac Sep 23, 2024
4c37e86
:sparkles: feat: header component 다크 모드 구현
ccconac Sep 23, 2024
4279343
:hammer: fix: layout theme provider 적용 및 불필요한 코드 제거
ccconac Sep 23, 2024
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
26 changes: 26 additions & 0 deletions grass-diary/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useEffect } from 'react';
import { RouterProvider } from 'react-router-dom';

import router from './router';
import { GlobalStyle } from './styles/GlobalStyle';
import useTheme from '@hooks/useTheme';

const App = () => {
const { isDarkMode } = useTheme();

useEffect(() => {
const root = document.body;

if (isDarkMode) root.setAttribute('data-theme', 'dark');
else root.removeAttribute('data-theme');
}, [isDarkMode]);

return (
<>
<GlobalStyle isDarkMode={isDarkMode} />
<RouterProvider router={router} />
</>
);
};

export default App;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion grass-diary/src/assets/svg/chevron_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion grass-diary/src/assets/svg/event_note.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion grass-diary/src/assets/svg/favorite_border.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion grass-diary/src/assets/svg/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion grass-diary/src/assets/svg/lock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion grass-diary/src/assets/svg/lock_open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion grass-diary/src/assets/svg/subdirectory_arrow_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion grass-diary/src/assets/svg/tag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions grass-diary/src/components/Button/BackButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ interface IBackButtonProps {
const BackButton = ({ goBackTo }: IBackButtonProps) => {
const navigate = useNavigate();
const location = useLocation();

const goBack = () => {
if (goBackTo) {
return navigate(goBackTo);
}
if (location.state === 'editcomplete') {
return navigate(-2);
}
if (goBackTo) return navigate(goBackTo);

if (location.state === 'editcomplete') return navigate(-2);

navigate(-1);
};

return (
<S.ArrowButton onClick={goBack}>
<S.ArrowIcon width={24} height={24} />
Expand Down
17 changes: 13 additions & 4 deletions grass-diary/src/components/Comment/CommentDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,24 @@ import CommentSetting from './CommentSetting';
import { useTodayDate } from '@hooks/api/useTodayDate';
import { useUser } from '@state/user/useUser';
import { COMMENT } from '@constants/message';
import useTheme from '@hooks/useTheme';

const CommentDisplay = ({ comment, parentId }: CommentDisplayProps) => {
const { data: writer } = useWriterProfile(comment.memberId);
const memberId = useUser();
const setting = useRef<HTMLDivElement>(null);

const { setReplyId } = useCommentActions();
const { date } = useTodayDate();
const setting = useRef<HTMLDivElement>(null);
const { isDarkMode } = useTheme();
const { data: writer } = useWriterProfile(comment.memberId);

const [isToday, setIsToday] = useState(false);

const reply = (e: React.MouseEvent<HTMLElement, MouseEvent>) => {
if (setting.current) {
if (setting.current.contains(e.target as HTMLElement)) return;
}

setReplyId(parentId);
};

Expand All @@ -38,15 +43,19 @@ const CommentDisplay = ({ comment, parentId }: CommentDisplayProps) => {
return comment.deleted ? (
<S.CommentItem $isMe={memberId === comment.memberId}>
<S.WriterBox>
{comment.depth ? <ReplyIcon /> : null}
{comment.depth ? (
<ReplyIcon fill={isDarkMode ? '#D4D4D4' : '#474747'} />
) : null}
<S.DeletedText>{COMMENT.deleted}</S.DeletedText>
</S.WriterBox>
</S.CommentItem>
) : (
<S.CommentItem onClick={reply} $isMe={memberId === comment.memberId}>
<S.TopBox>
<S.WriterBox>
{comment.depth ? <ReplyIcon /> : null}
{comment.depth ? (
<ReplyIcon fill={isDarkMode ? '#D4D4D4' : '#474747'} />
) : null}
<S.ProfileImage src={writer?.profileImageURL} />
<S.NameText $isMe={memberId === comment.memberId}>
{writer?.nickname}
Expand Down
4 changes: 3 additions & 1 deletion grass-diary/src/components/Comment/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { usePostComment } from '@hooks/api/comment/usePostComment';
import { usePatchComment } from '@hooks/api/comment/usePatchComment';
import { ReactComponent as ReplyIcon } from '@svg/subdirectory_arrow_right.svg';
import { COMMENT } from '@constants/message';
import useTheme from '@hooks/useTheme';

const CommentInput = ({
submit,
Expand All @@ -18,6 +19,7 @@ const CommentInput = ({
isCancelBtn,
isPatch,
}: CommentInputProps) => {
const { isDarkMode } = useTheme();
const { profileImageURL, nickname } = useProfile();
const { resetEditId, resetReplyId } = useCommentActions();
const [focus, setFocus] = useState(false);
Expand Down Expand Up @@ -54,7 +56,7 @@ const CommentInput = ({
<S.InputContainer $focus={focus} $isReply={isReply}>
<S.TopBox>
<S.WriterBox>
{isReply && <ReplyIcon />}
{isReply && <ReplyIcon fill={isDarkMode ? '#D4D4D4' : '#474747'} />}
<S.ProfileImage src={profileImageURL} />
<S.NameText>{nickname}</S.NameText>
</S.WriterBox>
Expand Down
22 changes: 10 additions & 12 deletions grass-diary/src/components/Container.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import stylex from '@stylexjs/stylex';

const styles = stylex.create({
container: {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',

gap: '10px',
},
});
import styled from 'styled-components';

const Container = ({ children }: IContainer) => {
return <div {...stylex.props(styles.container)}>{children}</div>;
return <SContainer>{children}</SContainer>;
};

export default Container;

const SContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;

background: ${({ theme }) => theme.bg.solid.subtler};
`;
7 changes: 2 additions & 5 deletions grass-diary/src/components/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { semantic } from '@styles/semantic';
import styled from 'styled-components';

interface IDividerProps {
Expand All @@ -19,8 +18,6 @@ const DividerLine = styled.div<{
width: ${({ $dividerWidth }) => $dividerWidth || '20rem'};
height: 0.0625rem;

background: ${({ $dividerColor }) =>
$dividerColor
? $dividerColor
: `${semantic.light.border.transparent.neutral}`};
background: ${({ $dividerColor, theme }) =>
$dividerColor ? $dividerColor : `${theme.border.transparent.neutral}`};
`;
3 changes: 2 additions & 1 deletion grass-diary/src/components/Feed/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useModal } from '@state/modal/useModal';
import { INTERACTION } from '@styles/interaction';
import { MODAL } from '@constants/message';
import { useUser } from '@state/user/useUser';
import { API_URI } from '@services/index';

interface IFeedProps {
feed: Feed;
Expand Down Expand Up @@ -38,7 +39,7 @@ const Feed = ({ feed, isTop }: IFeedProps) => {
};

const handleGoogleLogin: TGoogleLogin = () => {
window.open(`http://localhost:8080/api/auth/google`, '_self');
window.open(`${API_URI}/api/auth/google`, '_self');
};

const FeedClickHandler = () => {
Expand Down
24 changes: 21 additions & 3 deletions grass-diary/src/components/Feed/PopularFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,46 @@ import { Callout, Feed } from '@components/index';
import { usePopularDiaries } from '@hooks/api/usePopularDiaries';
import { Link, useLocation } from 'react-router-dom';
import { useEffect, useState } from 'react';
import useTheme from '@hooks/useTheme';

const PrevArrow = (props: CustomArrowProps) => {
const { isDarkMode } = useTheme();

return (
<S.ArrowBox onClick={props.onClick}>
<LeftArrow
width={20}
height={20}
fill={semantic.light.object.transparent.neutral}
fill={
isDarkMode
? semantic.dark.object.transparent.neutral
: semantic.light.object.transparent.neutral
}
/>
</S.ArrowBox>
);
};

const NextArrow = (props: CustomArrowProps) => {
const { isDarkMode } = useTheme();

return (
<S.ArrowBox onClick={props.onClick}>
<RightArrow
width={20}
height={20}
fill={semantic.light.object.transparent.neutral}
fill={
isDarkMode
? semantic.dark.object.transparent.neutral
: semantic.light.object.transparent.neutral
}
/>
</S.ArrowBox>
);
};

const PopularFeed = () => {
const { isDarkMode } = useTheme();
const { data: top10 } = usePopularDiaries();
const location = useLocation();
const [mobileSize, setMobileSize] = useState(false);
Expand Down Expand Up @@ -83,7 +97,11 @@ const PopularFeed = () => {
<RightArrow
width={18}
height={18}
fill={semantic.light.object.transparent.alternative}
fill={
isDarkMode
? semantic.dark.object.transparent.alternative
: semantic.light.object.transparent.alternative
}
/>
</S.SeeMoreContainer>
</Link>
Expand Down
11 changes: 7 additions & 4 deletions grass-diary/src/components/Layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import * as S from '@styles/component/Layout/Header.style';
import sampleLogo from '@image/sampleLogo.png';
import { useNavigate } from 'react-router-dom';

import MenuBar from './MenuBar';
import sampleLogo from '@image/sampleLogo.png';
import * as S from '@styles/component/Layout/Header.style';
import { Profile } from '@components/index';
import { useNavigate } from 'react-router-dom';
import { useUser } from '@state/user/useUser';
import { API_URI } from '@services/index';

const Header = () => {
const memberId = useUser();
const navigate = useNavigate();

const handleGoogleLogin: TGoogleLogin = () => {
window.open(`http://localhost:8080/api/auth/google`, '_self');
window.open(`${API_URI}/api/auth/google`, '_self');
};

return (
Expand Down
Loading