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

Component should accept className and styles should all be obj OR string #647

Closed
L5eoneill opened this issue Aug 19, 2016 · 6 comments
Closed

Comments

@L5eoneill
Copy link

Container style, all the other styles... need to let custom css module style names go in there in place of style objects. Also, the main component should accept standard Bootstrap 'className' prop.

@AllenFang
Copy link
Owner

@L5eoneill, all the className accept the string or a function which generate class name dynamically. and the style only accept object which follow jsx principle

<BootstrapTable insertRow exportCSV data={ products }
        tableStyle={ { border: '#0000FF 2.5px solid' } }
        containerStyle={ { border: '#FFBB73 2.5px solid' } }
        trClassName='tr-string-example'
>
          <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
          <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
          <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn>
      </BootstrapTable>

BTW, I'm not sure if I've answered your question, feel free to discuss with me :)
thanks

@L5eoneill
Copy link
Author

Yeah, doesn't completely address the issue, which is that many of the elements your component creates don't receive class names. Accepting a style object just isn't good enough. We get:

react-bs-table-container
react-bs-table
react-bs-container-header
react-bs-container-body

From your docs, none of these can take on a custom css class name, so if you're using css-modules, you have to work really hard to override even the smallest of default bootstrap stylings, using tricks like !important and :global(.react-bs-table) and such, which are frowned upon.

@AllenFang
Copy link
Owner

AllenFang commented Aug 25, 2016

@L5eoneill, ok, currently, tableHeaderClass and tableBodyClass only apply class name to header and body table. Maybe I can support another props for supporting to apply class name to following elements:

react-bs-table-container
react-bs-table
react-bs-container-header
react-bs-container-body

if ok, I can support it in near future.

@L5eoneill
Copy link
Author

Yes, that'd be excellent. Thanks.

@AllenFang
Copy link
Owner

use containerClass to apply class to react-bs-table-container
use tableContainerClass to apply class to react-bs-table
use headerContainerClass to apply class to react-bs-container-header
use bodyContainerClass to apply class to react-bs-container-body

Released on v2.4.4

@AllenFang
Copy link
Owner

there's one thing to notice, on v2.4.4 I move the css files from css to dist folder, remember to update the css path. I apologize for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants