evandhq/react-persian-datepicker

the classes are undefined

parisaabasian opened this issue ยท 7 comments

foreaxample :

and all other classes

screenshot from 2018-06-20 11-45-46

you are so lucky , i have no style ( every classes are undefined )

Use this css file. @thg303 gathered it from the one in the repository. don't forget to fix the extension to ".css"
evan-calender-style.css.txt

After adding styles, you need to present the styles to the DatePicker :

const styles= {
calendarContainer: 'calendarContainer',
dayPickerContainer: 'dayPickerContainer',
monthsList: 'monthsList',
daysOfWeek: 'daysOfWeek',
dayWrapper: 'dayWrapper',
selected: 'selected',
heading: 'heading'
}

then:

<DatePicker calendarStyles={styles}/>

Add this style to your css to force calendar shown on top of modals:

.tether-element {
    position: relative; z-index: 9999 !important; 
}
asiye commented

const styles = {
calendarContainer: "calendarContainer",
dayPickerContainer: "dayPickerContainer",
monthsList: "monthsList",
daysOfWeek: "daysOfWeek",
dayWrapper: "dayWrapper",
selected: "selected",
heading: "heading",
next: "next",
prev: "prev",
title: "title",
}

<Calendar styles={ styles } />
<DatePicker calendarStyles={ styles } />

when add this style careful to add last line of style { currentMonth:"currentMonth"}. this is working for me.
const styles = {
calendarContainer: "calendarContainer",
dayPickerContainer: "dayPickerContainer",
monthsList: "monthsList",
daysOfWeek: "daysOfWeek",
dayWrapper: "dayWrapper",
selected: "selected",
heading: "heading",
next: "next",
prev: "prev",
title: "title",
currentMonth:"currentMonth"
}

<Calendar styles={ styles } />
<DatePicker calendarStyles={ styles } />

Why is this not included in the docs?!

you are so lucky , i have no style ( every classes are undefined )

@nimahkh make sure you have css-loader and style-loader installed.