-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b333dc8
commit 6df791d
Showing
5 changed files
with
228 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { useState, useEffect } from 'react' | ||
import moment from 'moment' | ||
import buildCalender from '../../Screens/Calender/build' | ||
import Header from '../Sidebar/SideCalenderHeader' | ||
import dayStyles from '../../Screens/Calender/calender-day' | ||
import './side-calender.css' | ||
|
||
const SideCalendar = () => { | ||
const [calender, setCalender] = useState([]) | ||
const [value, setValue] = useState(moment()) | ||
const [eventtrue, setEventTrue] = useState(false) | ||
|
||
useEffect(() => { | ||
setCalender(buildCalender(value)) | ||
}, [value]) | ||
|
||
const handleEventChange = () => { | ||
setEventTrue(true) | ||
} | ||
|
||
return ( | ||
<> | ||
<div className='calendar-side'> | ||
<Header value={value} setValue={setValue} /> | ||
|
||
<div className='body-side'> | ||
<div className='day-names-side'> | ||
{['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map((d) => ( | ||
<div className='week-side'>{d}</div> | ||
))} | ||
</div> | ||
{calender.map((week) => ( | ||
<div> | ||
{week.map((day) => ( | ||
<div | ||
className='day-side' | ||
onClick={() => setValue(day)} | ||
> | ||
<div className={dayStyles(day, value) + '-side'} onClick={() => handleEventChange()}> | ||
{day.format('D').toString()} | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
))} | ||
</div> | ||
<button className='button-sidebar'>View Calender</button> | ||
</div> | ||
|
||
</> | ||
) | ||
} | ||
|
||
export default SideCalendar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react' | ||
|
||
export default function CalendarHeader ({ value, setValue }) { | ||
function currMonthName () { | ||
return value.format('MMMM') | ||
} | ||
|
||
function currYear () { | ||
return value.format('YYYY') | ||
} | ||
|
||
function prevMonth () { | ||
return value.clone().subtract(1, 'month') | ||
} | ||
|
||
function nextMonth () { | ||
return value.clone().add(1, 'month') | ||
} | ||
|
||
function thisMonth () { | ||
return value.isSame(new Date(), 'month') | ||
} | ||
|
||
return ( | ||
<div className='header-side'> | ||
<div className='calender-header-container-side'> | ||
<div className='calender-month-wrapper-side'> | ||
|
||
<div | ||
className='previous-side' | ||
onClick={() => setValue(prevMonth())} | ||
> | ||
{String.fromCharCode(171)} | ||
</div> | ||
<div className='current-side'> | ||
{currMonthName()} {currYear()} | ||
</div> | ||
|
||
<div className='next-side' onClick={() => setValue(nextMonth())}> | ||
{String.fromCharCode(187)} | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
.calendar-side { | ||
box-sizing: border-box; | ||
font-size: 1rem; | ||
max-width: 400px; | ||
position: fixed; | ||
left: 0; | ||
bottom: 0; | ||
} | ||
|
||
.header-side { | ||
background-color: #2b2b2c; | ||
text-align: center; | ||
line-height: 29px; | ||
color: white; | ||
font-weight: 300; | ||
height: 30px; | ||
font-size: 17px; | ||
} | ||
|
||
.day-names-side { | ||
display: flex; | ||
flex-wrap: wrap; | ||
width: 195px; | ||
margin: 0 auto; | ||
align-items: center; | ||
color: white; | ||
} | ||
|
||
.week-side { | ||
background-color: #141414; | ||
width: calc(100% / 7); | ||
height: 44px; | ||
line-height: 44px; | ||
text-align: center; | ||
color: rgb((172), 167, 167); | ||
font-weight: 300; | ||
} | ||
|
||
.week-side div { | ||
width: 100%; | ||
} | ||
|
||
.day-side { | ||
position: relative; | ||
width: calc(100% / 7); | ||
height: 44px; | ||
display: inline-block; | ||
background-color: black; | ||
padding: 0; | ||
margin: 0; | ||
box-sizing: border-box; | ||
z-index: 1; | ||
text-align: center; | ||
color: white; | ||
border: 1px solid rgb(22, 21, 21); | ||
line-height: 2; | ||
font-size: 14px; | ||
} | ||
|
||
.calender-month-wrapper-side { | ||
display: flex; | ||
} | ||
|
||
.calender-header-container-side { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
|
||
.today-side { | ||
background-color: rgb(64, 95, 80); | ||
height: 27px; | ||
width: 27px; | ||
border-radius: 5px; | ||
margin-top: 5px; | ||
} | ||
|
||
.before-side { | ||
color: white; | ||
background-color: rgb(12, 11, 11); | ||
height: 27px; | ||
width: 27px; | ||
border-radius: 5px; | ||
margin-top: 5px; | ||
} | ||
|
||
.previous-side { | ||
text-align: left; | ||
margin-left: 1rem; | ||
margin-right: 25px; | ||
color: rgba(0, 198, 136, 1); | ||
cursor: pointer; | ||
} | ||
|
||
.next-side { | ||
margin-left: 36px; | ||
color: rgba(0, 198, 136, 1); | ||
cursor: pointer; | ||
} | ||
|
||
.button-sidebar { | ||
background-color: #00c688; | ||
border: none; | ||
color: white; | ||
padding: 15px 32px; | ||
text-align: center; | ||
text-decoration: none; | ||
display: inline-block; | ||
font-size: 16px; | ||
width: 100%; | ||
} | ||
|
||
.selected-side { | ||
background-color: rgba(0, 198, 136, 1); | ||
color: white; | ||
font-weight: bold; | ||
height: 27px; | ||
width: 30px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters