Replies: 5 comments 2 replies
-
🤔 I don't remember how Anyway this is interesting... thanks for reporting. Probably we need to add a
I'd like first to reproduce this: any quick way to see this bug happening? Maybe by forking this code sandbox: https://codesandbox.io/s/react-day-picker-v8-eg8mw |
Beta Was this translation helpful? Give feedback.
-
I'm not sure how to reproduce my issue quick enough, cause it envolves a bunch of other internal dependencies. We have a lib with a bunch of helper methods for themes. Among others it has a method that tells you whether light or dark theme is being used currently (we support only 2 themes). const darkStyles ={
root: { backgroundColor: '#1e1e1e', color: getThemeColorWithOpacity('baseFontColor', 0.8, { theme }) }
}
const lightStyles = {
root: { backgroundColor: '#fff', color: getThemeColorWithOpacity('baseFontColor', 0.8, { theme }) }
}
const cssVariables = `
:root {
--rdp-accent-color: ${isDark ? '#3897FE' : '#0070c9'};
--rdp-background-color: ${isDark ? '#2b2b2b' : '#f2f2f2'};
}`
return (
<>
<style>
{styles}
{cssVariables}
</style>
<DayPicker
styles={isDark ? darkStyles : lightStyles}
/>
</>
) where I've stripped everything that isn't related to theming. While current solution is far from being elegant, it works. End result |
Beta Was this translation helpful? Give feedback.
-
It think you are mixing css classes and inline style and this is making difficult to understand where is the problem. The better option you have is to switch all to styled-component. Search the styled-components docs what is the best practice for importing a standard css file (from an external library). <style>
{styles}
{cssVariables}
</style> Remove this above and do not import anywhere the original .css file. You want to use only the DayPicker Remove the use of CSS variables in that object and alter it according to your tools. Also, styled-component should help you with the Moving this to the Github Discussion page, please keep the discussion going as we do want to easily support styled components. |
Beta Was this translation helpful? Give feedback.
-
@jodaka There was indeed a bug that was not passing down the className to the container component. I fixed this in beta-25 but I haven't tested it with styled-components. It should be possible to setup a CodeSandbox with styled-component, that would help my development. I will give a try when I have some time left :) |
Beta Was this translation helpful? Give feedback.
-
PS. using |
Beta Was this translation helpful? Give feedback.
-
Hi there,
I've been using 8-th version of react-day-picker to build custom date input component (an input that parses user input, and a calendar button that summons popup with day-picker). Everything works smoothly except one thing: i can't seem to figure how to apply ":hover" styles.
I'm using styled-components.
At the moment I used defaults styles and injected them into DOM just like docs suggests. Then I create object with custom styles and pass it as 'styles' prop into DayPicker. It works for everything, except :hover styles, which I can't override.
In my case calendar keep using
--rdp-accent-color
and--rdp-background-color
regardless of actual theme. Cause it has no clue what theme am I actually using. Is there any elegant ways of solving this issue?Beta Was this translation helpful? Give feedback.
All reactions