Skip to content

Commit

Permalink
여태까지 브랜치 분할되어 작업한것들 일단 모두 합치고 정리하냐고고 조금 지저분 했습니다!
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed May 20, 2024
1 parent a54a870 commit 6fcfbfa
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 16 deletions.
4 changes: 3 additions & 1 deletion components/atoms/CalendarDayBox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import "dayjs/locale/ko";

import { Box, Flex } from "@chakra-ui/react";
import dayjs from "dayjs";
import "dayjs/locale/ko";

import { dayjsToFormat } from "../../utils/dateTimeUtils";
import DatePointButton from "../molecules/DatePointButton";

Expand Down
5 changes: 2 additions & 3 deletions components/molecules/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { getTextSwitcherProps } from "../../pageTemplates/home/studyController/S
import { dayjsToStr, getCalendarDates } from "../../utils/dateTimeUtils";
import CalendarDayBox from "../atoms/CalendarDayBox";
import DatePointButton from "./DatePointButton";
import BetweenTextSwitcher from "./navs/BetweenTextSwitcher";

interface CalendarProps {
type: "week" | "month";
Expand All @@ -22,13 +21,13 @@ function Calendar({ type, selectedDate, func }: CalendarProps) {
console.log(calendarArr);
return (
<>
<BetweenTextSwitcher left={textSwitcherProps.left} right={textSwitcherProps.right} />
{/* <BetweenTextSwitcher left={textSwitcherProps.left} right={textSwitcherProps.right} /> */}

<>
{type === "week" ? (
<Flex overflow="auto">
{calendarArr.map((date, idx) => (
<Box key={idx} mr="14px">
<Box key={idx} mr="2px">
<CalendarDayBox date={date} selectedDate={dayjsToStr(selectedDate)} func={func} />
</Box>
))}
Expand Down
7 changes: 3 additions & 4 deletions components/molecules/DateVoteBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Box, Button, Flex } from "@chakra-ui/react";
import dayjs from "dayjs";

import { DateVoteButtonProps } from "../../pageTemplates/home/studyController/StudyControllerVoteButton";
import { dayjsToFormat } from "../../utils/dateTimeUtils";

interface DateVoteBlockProps {
buttonProps: DateVoteButtonProps;
Expand All @@ -14,16 +12,17 @@ function DateVoteBlock({ buttonProps, func }: DateVoteBlockProps) {
<Flex w="100%" className="main_vote_btn" h="77px" justify="space-between" align="center">
<Box fontSize="16px" fontWeight={500}>
<Box as="span" mr="4px">
오늘
현재 신청자:
</Box>
<Box as="span" color="var(--color-mint)">
{dayjsToFormat(dayjs(), "D일")}
5명
</Box>
</Box>
<Button
bgColor={buttonProps.color}
color={buttonProps.color === "var(--gray-400)" ? "black" : "white"}
onClick={func}
size="lg"
>
{buttonProps.text}
</Button>
Expand Down
58 changes: 58 additions & 0 deletions components/molecules/WeekSlideCalendar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Box, Flex } from "@chakra-ui/react";
import { Dayjs } from "dayjs";

import { getTextSwitcherProps } from "../../pageTemplates/home/studyController/StudyController";
import { dayjsToStr, getCalendarDates } from "../../utils/dateTimeUtils";
import CalendarDayBox from "../atoms/CalendarDayBox";

interface CalendarProps {
selectedDate: Dayjs;
func: (date: number) => void;
}

const DAYS = ["일", "월", "화", "수", "목", "금", "토"];

function WeekSlideCalendar({ selectedDate, func }: CalendarProps) {
const textSwitcherProps = getTextSwitcherProps(selectedDate, func);

const calendarArr = getCalendarDates("week", selectedDate);

return (
<>
{/* <BetweenTextSwitcher left={textSwitcherProps.left} right={textSwitcherProps.right} /> */}

<>
<Flex overflow="auto" flex={1}>
{calendarArr.map((date, idx) => (
<Box key={idx} mr="14px">
<CalendarDayBox date={date} selectedDate={dayjsToStr(selectedDate)} func={func} />
</Box>
))}
{/* <Flex h="42px" align="center" color="var(--gray-500)" fontWeight={500}>
{DAYS.map((day, idx) => (
<Flex justify="center" align="center" flex={1} h="30px" key={idx}>
{day}
</Flex>
))}
</Flex>
<Flex h="58px">
{calendarArr.map((dateStr, idx) => {
const date = dayjs(dateStr).date();
return (
<Flex mr="14px" key={idx} justify="center" align="center">
<DatePointButton
date={date}
func={func}
isSelected={date === selectedDate.date()}
/>
</Flex>
);
})}
</Flex> */}
</Flex>
</>
</>
);
}

export default WeekSlideCalendar;
22 changes: 15 additions & 7 deletions pageTemplates/home/studyController/StudyController.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Box, Flex } from "@chakra-ui/react";
import { faChevronDown } from "@fortawesome/pro-regular-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import dayjs, { Dayjs } from "dayjs";
import { useRouter, useSearchParams } from "next/navigation";
import { Dispatch, useEffect, useState } from "react";
import { useSetRecoilState } from "recoil";
import styled from "styled-components";

import Slide from "../../../components/layouts/PageSlide";
import Calendar from "../../../components/molecules/Calendar";
import WeekSlideCalendar from "../../../components/molecules/WeekSlideCalendar";
import DateCalendarModal from "../../../modals/aboutHeader/DateCalendarModal";
import StudyAttendCheckModal from "../../../modals/study/StudyAttendCheckModal";
import { studyDateStatusState } from "../../../recoils/studyRecoils";
Expand Down Expand Up @@ -53,13 +55,16 @@ function StudyController() {
<>
<Slide>
<OuterContainer className="about_calendar">
<ControllerHeader selectedDateDayjs={selectedDateDayjs} setModalType={setModalType} />
<InnerContainer>
{selectedDate && (
<>
<Box px="20px" borderBottom="var(--border)">
<Calendar type="week" selectedDate={selectedDateDayjs} func={onClick} />
</Box>
<Flex align="center" borderBottom="var(--border)">
<MonthButton>
<span>5월</span>
<FontAwesomeIcon icon={faChevronDown} />
</MonthButton>
<WeekSlideCalendar selectedDate={selectedDateDayjs} func={onClick} />
</Flex>
<StudyControllerVoteButton setModalType={setModalType} />
</>
)}
Expand All @@ -73,6 +78,11 @@ function StudyController() {
);
}

const MonthButton = styled.button`
width: 60px;
background-color: pink;
`;

interface ControllerHeaderProps {
selectedDateDayjs: Dayjs;
setModalType: Dispatch<VoteType>;
Expand Down Expand Up @@ -162,9 +172,7 @@ const handleMonthMoveByDate = (date: number, currentDate: number) => {

const OuterContainer = styled.div`
background-color: white;
border-radius: 12px;
position: relative;
`;

Expand Down
3 changes: 2 additions & 1 deletion utils/dateTimeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dayjs, { Dayjs } from "dayjs";
import "dayjs/locale/ko";

import dayjs, { Dayjs } from "dayjs";
import weekday from "dayjs/plugin/weekday";
dayjs.extend(weekday);

Expand Down

0 comments on commit 6fcfbfa

Please sign in to comment.