theKashey / react-focus-on

🎯 Solution for WAI ARIA compatible modal dialogs or full-screen tasks, you were looking for
MIT License
336 stars 14 forks source link

Add className prop #29

Closed sami616 closed 4 years ago

sami616 commented 4 years ago

Hi there i'm trying to add some styling to the div that is rendered using styled-components - but no className prop seems to be passed down to the underlying div.

theKashey commented 4 years ago

👍 legit case.

theKashey commented 4 years ago

The only problem - right now it would leave two divs, and you might need some class for both of them :(

sami616 commented 4 years ago

The requirement for styled-components is that a className prop is accepted by the component and passed down to the outer element. It will merge any existing classes with a generated one.

https://www.styled-components.com/docs/basics#styling-any-component

So essentially you'd be able to do something like this:

const MyComp = styled(FocusOn)`
  background: white;
  .some-other-nested-div {
    // other styles
  }
`
theKashey commented 4 years ago

Ok. So I've got it working. Give me some time (cooldown period) to double-check is this is what I want to merge...

theKashey commented 4 years ago

3.2.0 for the rescue!