-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
9 changed files
with
739 additions
and
72 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
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,17 @@ | ||
import styled from 'styled-components/native'; | ||
|
||
const DAY_PADDING = 10; | ||
|
||
const CALENDAR_WIDTH = 300; | ||
|
||
export const Calendar = styled.View` | ||
width: ${CALENDAR_WIDTH}px; | ||
`; | ||
|
||
export const Row = styled.View` | ||
flex-direction: row; | ||
`; | ||
|
||
export const Day = styled.TouchableOpacity` | ||
padding: ${DAY_PADDING}px; | ||
`; |
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,28 @@ | ||
import { memo, useState } from 'react'; | ||
import * as S from './Calendar.style'; | ||
import { useCalendar } from './hooks/useCalendar'; | ||
|
||
export interface CalendarProps { | ||
min?: Date; | ||
max?: Date; | ||
value?: Date; | ||
} | ||
|
||
export const Calendar = memo(({ min, max, value }: CalendarProps) => { | ||
const { | ||
buildCalendarDay, | ||
buildMonth, | ||
dayOfWeekAsString, | ||
monthsAsString | ||
} = useCalendar(); | ||
const [calendarDate, setCalendarDate] = useState<Date>(value || new Date()); | ||
|
||
const month = buildMonth(calendarDate, { min, max, value }); | ||
return ( | ||
<S.Calendar> | ||
{month.forEach(() => { | ||
|
||
})} | ||
</S.Calendar> | ||
); | ||
}) |
Empty file.
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,20 @@ | ||
import { useCalendar } from "../../hooks/useCalendar"; | ||
|
||
export const DayWeek = () => { | ||
const daysIndex = [0, 1, 2, 3, 4, 5, 6]; | ||
const { dayOfWeekAsString } = useCalendar(); | ||
return ( | ||
<div className="calendar-week-container"> | ||
{daysIndex.map((day) => { | ||
const key = day; | ||
return ( | ||
<div key={key} className="calendar-week"> | ||
<span> | ||
{dayOfWeekAsString(day)} | ||
</span> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './DayWeek/DayWeek'; |
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
Oops, something went wrong.