clauderic / react-infinite-calendar

✨ Infinite scrolling date-picker built with React, with localization, range selection, themes, keyboard support, and more.

Home Page:http://clauderic.github.io/react-infinite-calendar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

passing values to theme from scss

RajaSreekanth opened this issue · comments

Infinite Calendar is a cool widget. We are trying to use it in our project. However, the problem is we can't hard code the colors in the custom theme. I wonder if there is a way to set the values in the theme from regular style sheet. We are using SCSS.

I tried couple of options like sass-extractor to read the scss file and extract them as JSON, but they seem to work on 'node' environment only. Also, I'm not sure if that is the right approach. Please let me know an ideal way of doing this.

Thanks in advance.

Does this mean you can't customize the theme?

You can certainly customize the theme, there are a number of built-in customizations you can apply directly in JavaScript by passing a theme prop, see https://github.com/clauderic/react-infinite-calendar/blob/master/src/utils/defaultTheme.js for all possible customizations.

If you'd like more control, you can either fork the styles.css files that comes bundled with the npm package, or overwrite the styles yourself, as you normally would using css selectors.

Example:

.Cal__Day__root {
  background-color: red;
}