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

Datepicker can't be combined with styled-components #756

Open
mpaccione opened this issue Apr 17, 2022 · 2 comments
Open

Datepicker can't be combined with styled-components #756

mpaccione opened this issue Apr 17, 2022 · 2 comments

Comments

@mpaccione
Copy link

mpaccione commented Apr 17, 2022

The passing of the className prop should not be on the input directly but on the top level element.
When you set it directly to the input I cannot styled the injected date popup. This needs to be reworked.

The below code should work but doesn't of course.

import React from 'react'
import SemanticDatepicker from "react-semantic-ui-datepickers";
import styled from 'styled-components'
import "react-semantic-ui-datepickers/dist/react-semantic-ui-datepickers.css";


const StyledDatepicker = styled(SemanticDatepicker)`
    * {
        background-color: ${props => props.theme.input};
        color: ${props => props.theme.txt};
    }
    // or
    .clndr-calendars-segment {
        background-color: ${props => props.theme.input};
        color: ${props => props.theme.txt};   
    }
`

const ThemedDatepicker = ({ props }) => (
    <StyledDatepicker {...props} />
)

export { ThemedDatepicker }
@arthurdenner
Copy link
Owner

arthurdenner commented Apr 18, 2022

There's an open PR trying to solve this I think but I don't have much time to look at and update this project at the moment. If you want to tweak the current implementation to fix your needs, you can use something like patch-package or fork it. I'll leave the issue open as it's somewhat a problem and would be nice to support overrides with styled-components.

@arthurdenner arthurdenner changed the title Poor Styled Components Implementation Datepicker can't be combined with styled-components Apr 18, 2022
@mpaccione
Copy link
Author

mpaccione commented Apr 18, 2022

Thanks for responding.
Given that you don't have time to review open PR's I wont make one. However I will fix this to solve my own needs.

patch-package looks cool, thanks for the tip!

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