Skip to content

Commit

Permalink
Merge pull request #25 from farhoudshapouran/fix-web-styles
Browse files Browse the repository at this point in the history
fix: styling problems in web
  • Loading branch information
farhoudshapouran authored Oct 31, 2023
2 parents cee599c + db1c00e commit b54ec22
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import YearSelector from './YearSelector';
import MonthSelector from './MonthSelector';
import DaySelector from './DaySelector';
import TimeSelector from './TimeSelector';
import { CALENDAR_HEIGHT } from '../enums';

const CalendarView: Record<CalendarViews, ReactNode> = {
year: <YearSelector />,
Expand Down Expand Up @@ -39,7 +40,7 @@ const styles = StyleSheet.create({
width: '100%',
},
calendarContainer: {
height: 300,
height: CALENDAR_HEIGHT,
alignItems: 'center',
},
});
Expand Down
7 changes: 6 additions & 1 deletion src/components/DaySelector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { memo, useMemo } from 'react';
import { Text, View, TouchableOpacity, StyleSheet } from 'react-native';
import { useCalendarContext } from '../CalendarContext';
import { CALENDAR_HEIGHT } from '../enums';

const DaySelector = () => {
const { utils, currentDate, selectedDate, onSelectDate, theme } =
Expand Down Expand Up @@ -111,6 +112,7 @@ const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 5,
width: '100%',
},
weekDaysContainer: {
width: '100%',
Expand All @@ -128,14 +130,17 @@ const styles = StyleSheet.create({
justifyContent: 'center',
},
daysContainer: {
flex: 1,
width: '100%',
height: '100%',
flexWrap: 'wrap',
flexDirection: 'row',
justifyContent: 'center',
alignContent: 'flex-start',
},
dayCell: {
width: '14.2%',
height: '14.2%',
height: CALENDAR_HEIGHT / 7 - 1,
},
dayContainer: {
flex: 1,
Expand Down
1 change: 0 additions & 1 deletion src/components/MonthSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const styles = StyleSheet.create({
monthsContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
margin: 5,
},
monthCell: {
width: '33.3%',
Expand Down
2 changes: 2 additions & 0 deletions src/components/YearSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ const styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
margin: 5,
width: '100%',
},
yearCell: {
width: '33.3%',
},
yearsRow: {
flexDirection: 'row',
width: '100%',
},
year: {
paddingVertical: 15,
Expand Down
2 changes: 2 additions & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ export enum CalendarActionKind {
CHANGE_CURRENT_DATE = 'CHANGE_CURRENT_DATE',
CHANGE_SELECTED_DATE = 'CHANGE_SELECTED_DATE',
}

export const CALENDAR_HEIGHT = 300;

0 comments on commit b54ec22

Please sign in to comment.