import React, { useState, useEffect } from 'react'; import Menu from '../Components/Menu'; import styled from 'styled-components'; import moment from 'moment'; import "moment/locale/ko"; moment.locale("ko", { week: { dow: 1 } }); const Drop = styled.div` & button { border solid 1px; } ` const Schedule = styled.div` & ul { list-style-type: none; } & .cd-schedule__events { width: 100%; > ul { display: flex; flex-wrap: nowrap; } } & .cd-schedule__group { flex-basis: 0; flex-grow: 1; } & .cd-schedule__event { position: absolute; z-index: 3; width: calc(100% + 2px); // top position and height will be set using js left: -1px; } ` function Home() { const [show, setShow] = useState(false); const [weeks, setWeeks] = useState([]); useEffect(() => { Dateform(); }, []); function Dateform() { let today = moment(); let dates = { start: null, end: null }; for (let i = 0; i < 6; i++) { if (i !== 0) { today.add(7, 'd'); } dates.start = today.startOf('week').format("MMM Do"); dates.end = today.endOf('week').weekday(4).format("MMM Do"); const week = dates.start + " ~ " + dates.end; weeks.push(week); }; setWeeks([...weeks]) }; return (
{weeks.map((week, index) => ( setShow(true)}>{week} ))}
  • 09:00
  • 10:00
  • 11:00
  • 12:00
  • 13:00
  • 14:00
  • 15:00
  • 16:00
  • 17:00
  • 18:00
  • 19:00
  • 20:00
  • 21:00
  • 22:00
{/* */}
) } export default Home