Commit eb9bcd78 authored by Kim, Subin's avatar Kim, Subin
Browse files

Calender 수정 중

parent 566a6042
...@@ -7,6 +7,7 @@ import styles from "./calender.module.scss"; ...@@ -7,6 +7,7 @@ import styles from "./calender.module.scss";
const Calender = ({ selectDate, setSelectDate }) => { const Calender = ({ selectDate, setSelectDate }) => {
const [dateList, setDateList] = useState([]) const [dateList, setDateList] = useState([])
const [dateArr, setDateArr] = useState([]) const [dateArr, setDateArr] = useState([])
const [date, setDate] = useState(moment().format('YYYY-MM-DD'))
const [weekly, setWeekly] = useState([]) const [weekly, setWeekly] = useState([])
const [week, setWeek] = useState(["", "", "", "", "", "", ""]) const [week, setWeek] = useState(["", "", "", "", "", "", ""])
const [month, setMonth] = useState({ pre: moment(selectDate).subtract(1, 'months').format('YYYY-MM'), cur: moment(selectDate).format('YYYY-MM'), next: moment(selectDate).add(1, 'months').format('YYYY-MM') }) const [month, setMonth] = useState({ pre: moment(selectDate).subtract(1, 'months').format('YYYY-MM'), cur: moment(selectDate).format('YYYY-MM'), next: moment(selectDate).add(1, 'months').format('YYYY-MM') })
...@@ -53,6 +54,8 @@ const Calender = ({ selectDate, setSelectDate }) => { ...@@ -53,6 +54,8 @@ const Calender = ({ selectDate, setSelectDate }) => {
} }
function preWeek() { function preWeek() {
const preDate = moment(date).week()
console.log("week==",preDate)
// let dateArr = [] // let dateArr = []
// dateArr = Array(7).fill(0).map((n, i) => { // dateArr = Array(7).fill(0).map((n, i) => {
// let current = moment(oneDay).add((n + i), 'days') // let current = moment(oneDay).add((n + i), 'days')
...@@ -102,7 +105,7 @@ const Calender = ({ selectDate, setSelectDate }) => { ...@@ -102,7 +105,7 @@ const Calender = ({ selectDate, setSelectDate }) => {
</div> </div>
</div> </div>
<i className={`col-1 bi bi-chevron-left align-self-center text-center ${styles.cursor}`} onClick={preWeek}></i> <i className={`col-1 bi bi-chevron-left align-self-center text-center ${styles.cursor}`} onClick={preWeek}></i>
<div className={`d-flex justify-content-between col-10 ${styles.box}`}>{weekly.map(el => el)}</div> <div className={`d-flex justify-content-between col-10 ${styles.box}`}>{dateList.map(el => el)}</div>
<i className={`col-1 bi bi-chevron-right align-self-center text-center ${styles.cursor}`} onClick={nextWeek}></i> <i className={`col-1 bi bi-chevron-right align-self-center text-center ${styles.cursor}`} onClick={nextWeek}></i>
</div> </div>
</> </>
......
.box { .box {
overflow: hidden; overflow: hidden;
transform: translate3d(-420px, 0px, 0px);
transition: all 0.6s ease 0s;
& .yearmonth { & .yearmonth {
position: relative; position: relative;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment