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
Compatibility with styled-components #321
Comments
Same here. const Paginate = styled(ReactPaginate).attrs({
containerClassName: "container",
breakClassName: "break-me",
activeClassName: "active"
})`
&.container {
display: flex;
flex-direction: row;
justify-content: space-between;
list-style-type: none;
}
&.break-me {
cursor: default;
}
&.active {
background-color: #0366d6;
border-color: transparent;
color: white;
min-width: 32px;
}
`; Anyway, classNames are applied. |
Try break-me and active without the & because they are applied to elements further down the Dom. The container Styles should be applied though, as I guess from the couch. |
Container is not applied. |
My bad, has been late. The essential generated classname from styled components is still missing, of course. |
Any plans to make this compatible with styled-components? |
I temporarily solved this problem by wrapping it with the styled component. const StyledPaginateContainer = styled.div`
.pagination {
color: #0366d6;
}
.break-me {
cursor: default;
}
.active {
border-color: transparent;
background-color: #0366d6;
color: white;
}
`; <StyledPaginateContainer>
<ReactPaginate
previousLabel="previous"
nextLabel="next"
breakLabel="..."
breakClassName="break-me"
pageCount={20}
marginPagesDisplayed={2}
pageRangeDisplayed={5}
onPageChange={pagination => {
console.log(pagination);
}}
containerClassName="pagination"
activeClassName="active"
/>
</StyledPaginateContainer> |
We use the same approach to work around that even before I opened this issue. But compatibility would be easily achieved with making (additional) use of the standard Personally I don't like having to use a special prop just to assign the class name for the outer most container of a component. |
but it is not working for |
I was facing same issue and so have created headless pagination component like this. |
Hi, We've added the Thanks for the reports and workarounds! |
You can find an example in demo with https://github.com/AdeleD/react-paginate/blob/master/demo/js/demo.js#L11 |
It would be nice to have direct compatibility with
styled-component
by accepting the standardclassName
prop as alternative to thecontainerClassName
prop. Otherwise styling withstyled-components
is only possible by wrapping the component in an extra wrapper component.The text was updated successfully, but these errors were encountered: