Skip to content

Commit

Permalink
Merge pull request #42 from NohWookJin/feature/#40
Browse files Browse the repository at this point in the history
 Feature(#40): Add Dark Mode
  • Loading branch information
NohWookJin authored Jun 5, 2024
2 parents c693167 + d18ae40 commit 4b9e521
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Components/Profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const Profile = () => {
</div>
<div className="flex flex-col gap-[5px]">
<span className="text-[18px] font-semibold">SPRINTER</span>
<div className="bg-[#3A7CE1] cursor-pointer font-bold max-w-[60px] flex items-center justify-center rounded-[12px] py-[3px] shadow-lg border border-gray-300 transform transition-all duration-300 ease-in-out hover:scale-105">
<div className="border-none bg-[#3A7CE1] cursor-pointer font-bold max-w-[60px] flex items-center justify-center rounded-[12px] py-[3px] shadow-lg border border-gray-300 transform transition-all duration-300 ease-in-out hover:scale-105">
<span className="text-[13px] text-[white]">
<span className="pr-[2px] font-semibold">
{calculateDaysSinceCreated(profile?.createdAt as string)}
Expand All @@ -105,7 +105,7 @@ const Profile = () => {
<>
{profile.badges.map((item, index) => (
<div
className={`text-[13px] cursor-pointer font-bold w-fit flex items-center justify-center rounded-[12px] py-[3px] px-[10px] ${onChangeBadge(
className={`border-none text-[13px] cursor-pointer font-bold w-fit flex items-center justify-center rounded-[12px] py-[3px] px-[10px] ${onChangeBadge(
item
)} shadow-lg border border-gray-300 transform transition-all duration-300 ease-in-out hover:scale-105`}
key={index}
Expand Down
9 changes: 9 additions & 0 deletions src/Components/RoutineBlogDetail/QuillStlye.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@
background-color: rgb(255, 255, 255);
width: 100%;
}
.dark .ql-container {
color: white;
}

.dark .ql-toolbar.ql-snow {
border: none !important;
background-color: rgba(0, 0, 0, 0.7);
color: white;
}
20 changes: 17 additions & 3 deletions src/Components/RoutineBlogDetail/RoutineBlogDetailEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import "react-quill/dist/quill.snow.css";
import "./QuillStlye.css";
import { postBlog } from "../../API/routinesBlog";
import { formatDateToISO } from "../../lib/timeFormatChange";
import { useRecoilValue } from "recoil";
import { themeState } from "../../Store/themeState";

Quill.register("modules/imageActions", ImageActions);
Quill.register("modules/imageFormats", ImageFormats);
Expand All @@ -26,6 +28,8 @@ interface BlogForm {
}

const RoutineBlogDetailEditor = () => {
const darkMode = useRecoilValue(themeState);

const location = useLocation();
const navigate = useNavigate();

Expand Down Expand Up @@ -183,14 +187,18 @@ const RoutineBlogDetailEditor = () => {
return (
<form
onSubmit={onSubmit}
className="flex flex-col shadow-lg pt-[20px] relative"
className={`flex flex-col shadow-lg pt-[20px] relative ${
darkMode ? "dark: bg-[#23272f]" : ""
}`}
>
<div className="flex justify-center gap-[30px] mb-[20px]">
<input
onChange={onChangeTitle}
placeholder="제목을 입력하세요."
type="text"
className="px-[3px] py-[20px] w-[95%] text-[30px] border-b border-[#d9d9d9] focus:outline-none"
className={`px-[3px] pl-[20px] py-[20px] w-[100%] text-[30px] border-b border-[#d9d9d9] focus:outline-none ${
darkMode ? "dark: text-white bg-[#23272f]" : ""
}`}
/>
</div>
<ReactQuill
Expand All @@ -202,7 +210,13 @@ const RoutineBlogDetailEditor = () => {
onChange={onChangeContent}
placeholder="루틴을 시작해보세요..."
/>
<div className="absolute bg-white bottom-0 z-50 sticky shadow-2xl flex justify-between px-[15px] py-[15px]">
<div
className={`absolute bottom-0 z-50 sticky shadow-2xl flex justify-between px-[15px] py-[15px] ${
darkMode
? "border-t dark: bg-[#23272f] text-white"
: "bg-white text-black"
}`}
>
<button onClick={onClickBackArrow} className="font-semibold">
&larr; 나가기
</button>
Expand Down
20 changes: 17 additions & 3 deletions src/Components/RoutineBlogDetail/RoutineBlogDetailEditorEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import "./QuillStlye.css";
import { patchBlog } from "../../API/routinesBlog";
import { useSetRecoilState } from "recoil";
import { editState } from "../../Store/editState";
import { useRecoilValue } from "recoil";
import { themeState } from "../../Store/themeState";

Quill.register("modules/imageActions", ImageActions);
Quill.register("modules/imageFormats", ImageFormats);
Expand All @@ -41,6 +43,8 @@ const RoutineBlogDetailEditorEdit = ({
content,
date,
}: EditProps) => {
const darkMode = useRecoilValue(themeState);

const setIsEdit = useSetRecoilState(editState);
const navigate = useNavigate();

Expand Down Expand Up @@ -156,15 +160,19 @@ const RoutineBlogDetailEditorEdit = ({
return (
<form
onSubmit={onSubmit}
className="flex flex-col shadow-lg pt-[20px] relative"
className={`flex flex-col shadow-lg pt-[20px] relative ${
darkMode ? "dark: bg-[#23272f]" : ""
}`}
>
<div className="flex justify-center gap-[30px] mb-[20px]">
<input
onChange={onChangeTitle}
placeholder="제목을 입력하세요."
value={formDataBlog.title}
type="text"
className="px-[3px] py-[20px] w-[95%] text-[30px] border-b border-[#d9d9d9] focus:outline-none"
className={`px-[3px] pl-[20px] py-[20px] w-[100%] text-[30px] border-b border-[#d9d9d9] focus:outline-none ${
darkMode ? "dark: text-white bg-[#23272f]" : ""
}`}
/>
</div>
<ReactQuill
Expand All @@ -176,7 +184,13 @@ const RoutineBlogDetailEditorEdit = ({
onChange={onChangeContent}
placeholder="루틴을 시작해보세요..."
/>
<div className="absolute bg-white bottom-0 z-50 sticky shadow-2xl flex justify-between px-[15px] py-[15px]">
<div
className={`absolute bottom-0 z-50 sticky shadow-2xl flex justify-between px-[15px] py-[15px] ${
darkMode
? "border-t dark: bg-[#23272f] text-white"
: "bg-white text-black"
}`}
>
<button onClick={onClickBackArrow} className="font-semibold">
&larr; 취소하기
</button>
Expand Down
7 changes: 6 additions & 1 deletion src/Components/RoutineSetting/RoutineSettingItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { FormEvent, useEffect, useRef, useState } from "react";
import { useRecoilValue } from "recoil";
import { themeState } from "../../Store/themeState";

interface RoutineSettingItemProps {
item: RoutineSettingItemDetail;
Expand All @@ -24,6 +26,7 @@ const RoutineSettingItem = ({
const { name, colorSelection, id } = item;
const [isEdit, setIsEdit] = useState<boolean>(false);
const [newRoutineName, setNewRoutineName] = useState<string>(name);
const darkMode = useRecoilValue(themeState);

const inputRef = useRef<HTMLInputElement>(null);

Expand Down Expand Up @@ -66,7 +69,9 @@ const RoutineSettingItem = ({
ref={inputRef}
value={newRoutineName}
onChange={(e) => setNewRoutineName(e.target.value)}
className="focus:outline-none"
className={`focus:outline-none ${
darkMode ? "dark: bg-[#23272f] text-white" : ""
}`}
/>
</form>
) : (
Expand Down

0 comments on commit 4b9e521

Please sign in to comment.