diff --git a/src/components/global/Calendar.tsx b/src/components/global/Calendar.tsx
index a17e1aa..1de76d2 100644
--- a/src/components/global/Calendar.tsx
+++ b/src/components/global/Calendar.tsx
@@ -20,6 +20,9 @@ import sharp from "../../icons/sharp.svg";
// Types
import { dataItem, dateMatrix } from "../../helpers/calendar";
+// Components
+import CalendarCell from "./CalendarCell";
+
const Calendar = () => {
// Static
const date = new Date();
@@ -172,87 +175,58 @@ const Calendar = () => {
{sorted
? sorted.map((arr) => {
if (arr.filter((x) => x === 0).length !== 7) {
- return (
+ return(
- {arr.map((el) => {
- if (el !== 0) {
- if (
- today === el &&
- currentMonth === date.getMonth() &&
- currentYear === date.getFullYear()
- ) {
- return (
-
- ) => {
- const target = e.target as HTMLElement;
- const span = target.innerText;
- setSelectedDay({
- day: parseInt(span),
- month: currentMonth,
- });
- }}
- >
- {el}
-
-
- 
-
- {`${el} ${matchLocaleLang(
- currentMonth
- )} ${currentYear}`}
- Нет событий
-
- |
- );
- } else {
- return (
-
- ) => {
- const target = e.target as HTMLElement;
- const span = target.innerText;
- setSelectedDay({
- day: parseInt(span),
- month: currentMonth,
- });
- }}
- >
- {el}
-
-
- 
-
- {`${el} ${matchLocaleLang(
- currentMonth
- )} ${currentYear}`}
- Нет событий
-
- |
- );
- }
+ {arr.map((el) => {
+ if (el !== 0) {
+ if (
+ today === el &&
+ currentMonth === date.getMonth() &&
+ currentYear === date.getFullYear()
+ ) {
+ return (
+
+ );
} else {
- return | ;
+ return (
+
+ ) => {
+ const target = e.target as HTMLElement;
+ const span = target.innerText;
+ setSelectedDay({
+ day: parseInt(span),
+ month: currentMonth,
+ });
+ }}
+ >
+ {el}
+
+
+ 
+
+ {`${el} ${matchLocaleLang(
+ currentMonth
+ )} ${currentYear}`}
+ Нет событий
+
+ |
+ );
}
- })}
-
- );
+ } else {
+ return | ;
+ }
+ })}
+
+ )
} else {
return "";
}
diff --git a/src/components/global/CalendarCell.tsx b/src/components/global/CalendarCell.tsx
new file mode 100644
index 0000000..17734d4
--- /dev/null
+++ b/src/components/global/CalendarCell.tsx
@@ -0,0 +1,66 @@
+// Modules
+import React, {SetStateAction} from 'react';
+
+
+// Helpers
+import { matchLocaleLang } from "../../helpers/calendar";
+
+// Icons
+import sharp from "../../icons/sharp.svg";
+
+interface dayType {
+ day: number;
+ month: number;
+ }
+ type monthType = [number, React.Dispatch>];
+ type dayStateType = [dayType, React.Dispatch>];
+
+interface Props{
+ setSelectedDay: dayStateType[1],
+ selectedDay: dayType,
+ el: number,
+ currentMonth: monthType[0],
+ currentYear: monthType[0],
+ event?: string,
+}
+
+const CalendarCell = ({selectedDay, setSelectedDay, el, currentMonth, currentYear, event}:Props) => {
+ return(
+ // {el !== 0 ? (
+ //
+ // ) => {
+ // const target = e.target as HTMLElement;
+ // const span = target.innerText;
+ // setSelectedDay({
+ // day: parseInt(span),
+ // month: currentMonth,
+ // });
+ // }}
+ // >
+ // {el}
+ //
+ //
+ // 
+ //
+ // {`${el} ${matchLocaleLang(
+ // currentMonth
+ // )} ${currentYear}`}
+ // Нет событий
+ //
+ // |
+ // ) : (
+
+ // )}
+
+ )
+}
+
+export default CalendarCell;
\ No newline at end of file