From ce2659c4a2c4c087431e6ce827419919cba7c552 Mon Sep 17 00:00:00 2001 From: Farhoud Shapouran Date: Mon, 17 Feb 2025 23:50:31 +0300 Subject: [PATCH] Delete src/components/Months.tsx --- src/components/Months.tsx | 115 -------------------------------------- 1 file changed, 115 deletions(-) delete mode 100644 src/components/Months.tsx diff --git a/src/components/Months.tsx b/src/components/Months.tsx deleted file mode 100644 index 51add16..0000000 --- a/src/components/Months.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import React, { useMemo } from 'react'; -import { View, StyleSheet, Pressable, Text } from 'react-native'; -import { useCalendarContext } from '../calendar-context'; -import { getParsedDate, getMonthsArray, cn } from '../utils'; -import { CONTAINER_HEIGHT } from '../enums'; - -const Months = () => { - const { - currentDate, - onSelectMonth, - styles = {}, - classNames = {}, - components = {}, - containerHeight = CONTAINER_HEIGHT, - monthsFormat = 'full', - } = useCalendarContext(); - - const style = useMemo( - () => createDefaultStyles(containerHeight), - [containerHeight] - ); - - const { month } = getParsedDate(currentDate); - - const containerStyle = StyleSheet.flatten([ - defaultStyles.container, - styles?.months, - ]); - - return ( - - - {getMonthsArray()?.map((item, index) => { - const isSelected = index === month; - - const itemStyle = StyleSheet.flatten([ - defaultStyles.month, - styles.month, - isSelected && styles.selected_month, - ]); - - const textStyle = StyleSheet.flatten([ - styles.month_label, - isSelected && styles.selected_month_label, - ]); - - const containerClassName = cn( - classNames.month, - isSelected && classNames.selected_month - ); - - const textClassName = cn( - classNames.month_label, - isSelected && classNames.selected_month_label - ); - - return ( - - {components.Month ? ( - onSelectMonth(index)} - accessibilityRole="button" - accessibilityLabel={item.name.full} - style={defaultStyles.month} - > - {components.Month({ ...item, isSelected })} - - ) : ( - onSelectMonth(index)} - accessibilityRole="button" - accessibilityLabel={item.name.full} - style={itemStyle} - className={containerClassName} - > - - {item.name[monthsFormat]} - - - )} - - ); - })} - - - ); -}; - -const defaultStyles = StyleSheet.create({ - container: { - flex: 1, - alignItems: 'center', - justifyContent: 'center', - }, - months: { - flexDirection: 'row', - flexWrap: 'wrap', - }, - month: { - flex: 1, - margin: 2, - alignItems: 'center', - justifyContent: 'center', - }, -}); - -const createDefaultStyles = (containerHeight: number) => - StyleSheet.create({ - monthCell: { - width: `${100 / 3}%`, - height: containerHeight / 6, - }, - }); - -export default Months;