Skip to content

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

@mpaccione

Description

@mpaccione

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 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions