react-redux-starter-kit icon indicating copy to clipboard operation
react-redux-starter-kit copied to clipboard

How to override base style in component css file?

Open AzrielLiang opened this issue 9 years ago • 2 comments

The scenario is that I imported react-slick, downloaded the slick.css file and put it into the base folder, the _base.css file is like this:

 @import './slick/slick';

This is how I create a Slider component:

    <div styleName='mySliderClass'>
      <Slider >
        <ul styleName='category'>
          {this.props.businessTypes.map((e) => {
            return <BusinessLink key={e.slug}
              slug={e.slug}
              text={e.business_type}
              onClick={this.props.chooseBusiness} />
          })}
        </ul>
      </Slider>
    </div>

FYI, styleName is from react-css-module. And In the component css file I try to do something like this to override the slick.css:

.mySliderClass .someSlickClass {
  width: 500px; //try to override slick css
}

But this doesn't work. So how to solve this problem?

AzrielLiang avatar Jul 14 '16 06:07 AzrielLiang

@AzrielLiang I have exactly the same issue. https://github.com/akiran/react-slick/issues/675 have you solved it someway ?

alduro avatar Mar 20 '17 14:03 alduro

You need to add an id to the div to override the imported style from the package like so:

#myCoolID.mySliderClass .someSlickClass

grootendorste avatar Jul 12 '18 10:07 grootendorste