Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DayPicker modifiers not working with CSS Modules #558

Closed
rus-yurchenko opened this issue Nov 22, 2017 · 5 comments
Closed

DayPicker modifiers not working with CSS Modules #558

rus-yurchenko opened this issue Nov 22, 2017 · 5 comments

Comments

@rus-yurchenko
Copy link

rus-yurchenko commented Nov 22, 2017

Hi there, seems like modifiers not working when a CSS Modules enabled.
It grabs all the styles properly but modifiers functionality don't work.

An issue only with classNames={styles} prop.
Tested with default disabled and selected modifiers from example.
console.log inside handleDayClick = (day, {selected, disabled}) gets selected and disabled always undefined with a CSS modules.

Possible related to #504.

@gpbl
Copy link
Owner

gpbl commented Nov 22, 2017

Are you using DayPicker or DayPickerInput?

@rus-yurchenko
Copy link
Author

DayPicker

@gpbl
Copy link
Owner

gpbl commented Nov 22, 2017

The modifiers are the class names you import from the css module, so selected or disabled will be always undefined. This should work instead:

import styles from './MyCSSModule.css';
// ...
handleDayClick(day, modifiers) {
    console.log(modifiers[styles.disabled]);
}

@gpbl
Copy link
Owner

gpbl commented Nov 22, 2017

If it works for you please close this issue, thanks!

@rus-yurchenko
Copy link
Author

@gpbl Thanks! It would be nice to add a small paragraph with this case to the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants