-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Rework Panel API #1769
Rework Panel API #1769
Conversation
Worth noting, BTW, that |
true tho Card is philosophically similar...I am hoping it lends itself to a better API more tho |
Can we do something with I'm thinking we have If no For a As for the heading API, maybe <Panel collapse>
<Panel.Heading>
<Panel.Title toggle>
Panel title
</Panel.Title>
</Panel.Heading>
<Panel.Body>
Panel body
</Panel.Body>
</Panel> |
that seems like a good idea, though we still need a way to say "don't wrap this table or ListGroup", maybe just have them add
I like that, however there is no good default component for |
I do think
is reasonable and will probably be good enough in practice. That title thing is messy, I dunno. |
how do we feel about this APi as it stands? the Title thing is a bit annoying but seems like defaulting to a I will fix up docs and examples if ya'll feel good about it. |
The new panel feature will add at next version? I like this new customized panel title and really need it! 😄 |
Really nice work on this PR! I've been banging my head against the wall trying to inject an icon and some controls into accordion panel headers, this makes it a piece of cake. As somebody brand new to react-bootstrap, I personally don't find the API overly verbose – everything does exactly what you'd expect, especially if you're coming from the HTML version of Bootstrap. Do you know if this is going to make it into master? |
What's the status for this pull-request? Is there any help needed? Right now you can't customize the toggle element in the header and this looks quite complete :). |
I should rebase this... |
👍 |
any update on this? |
Anyone want to fix the tests? |
Wow, good work @jquense but I'm afraid I'm not going to be much help, I don't understand it all well enough. All I know is that I'd like to be able to style my panel headers to make them clickable in their entirety rather than just the heading titles! |
What's the progress on this? |
Same question, any updates? I see the panel branch has updated docs just the tests are failing. |
@jquense Any idea if/when this is going to get merged, the underlying issue is responsible for about 90% of my UI "bugs" list at the moment, it's getting annoying! :/ |
@Siyfion it will, thanks for the ping on this. |
@jquense Cheers, like I said, I think this is really my only "main" issue with React-Bootstrap at the moment, so it'd be great to get it all merged in. 👍 |
this should be goood to go for review @react-bootstrap/collaborators . Me and @taion don't actually use the Panel components often (one reason why this is been so slow) so any other input is greatly appreciated on the API and on the code quality. @Siyfion if you want to jump in as well and make sure it addresses your use cases and bugs 👍 |
Awesome!! |
done |
id="collapsible-panel-example-1" | ||
expanded={this.state.open} | ||
> | ||
<Panel.Collapse> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping?
<Panel.Heading> | ||
<Panel.Title toggle>Panel heading 1</Panel.Title> | ||
</Panel.Heading> | ||
<Panel.Body collapsible > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
test/utils/bootstrapUtilsSpec.js
Outdated
@@ -120,9 +120,9 @@ describe('bootstrapUtils', () => { | |||
shouldWarn('expected one of ["minimal","boss","plaid","tweed"]'); | |||
|
|||
const Component = bsStyles(['minimal', 'boss', 'plaid', 'tweed'], 'plaid')( | |||
class extends React.Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a bad refactor somewhere, just fixing it
src/Panel.js
Outdated
defaultExpanded: PropTypes.bool, | ||
/** | ||
* Controls the collapsed/expanded state ofthe Panel. Requires a `Panel.Collapse` or `<Panel.Body collapsible>` child component | ||
* in order to actually animate out or in, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:p
PanelHeading.defaultProps = defaultProps; | ||
PanelHeading.contextTypes = contextTypes; | ||
|
||
export default bsClass('panel', PanelHeading); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arguably this (and the others) should be like <TabPane>
where the bsClass
is tab-pane
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets defer that, we should do do big rethink of this api anyway, and reach some consistent policy for child components
src/utils/bootstrapUtils.js
Outdated
@@ -15,12 +15,18 @@ function curry(fn) { | |||
}; | |||
} | |||
|
|||
export function prefix(props, variant) { | |||
export function prefix(props, context, variant) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't see our using the 3-arg form of this anywhere any more
I've been swamped. Will try to look over the weekend. |
* Upgrade `uncontrollable` dependency * remove createClass in tests (react-bootstrap#2586) * remove createClass in tests * fix-lint * update changelog * Release v0.31.0 * Add toggle button components (react-bootstrap#2252) I’m tried of rewriting this component all the time :P * Update Dropdown.js (react-bootstrap#2615) fix typo * switch to new one (react-bootstrap#2621) * Rework Panel API * update * fix up the branch, fix examples * Finish tests * Update PanelHeading.js * prop-types clean up * change collapsible API, finish examples and docs * lint: * clean up nits * nits
@@ -1,5 +1,11 @@ | |||
import { cloneElement } from 'react'; | |||
import ReactDOM from 'react-dom'; | |||
import tsp from 'teaspoon'; | |||
|
|||
tsp.fn.log = function log() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jquense Was this addition intentional?
What's the latest on this? Anything I can do to help out here? |
* Rework Panel API (#1769) * Upgrade `uncontrollable` dependency * remove createClass in tests (#2586) * remove createClass in tests * fix-lint * update changelog * Release v0.31.0 * Add toggle button components (#2252) I’m tried of rewriting this component all the time :P * Update Dropdown.js (#2615) fix typo * switch to new one (#2621) * Rework Panel API * update * fix up the branch, fix examples * Finish tests * Update PanelHeading.js * prop-types clean up * change collapsible API, finish examples and docs * lint: * clean up nits * nits * remove pagination logic (#2587) * remove pagination logic * Add upgrade path. * Transition group (#2676) * switch to react transition group * Update Modal api * fix tests * bump and fix test * Update package.json * update wording * preventDefault specified to work only for disabled && onSelect; it is a fix for issue #2711 * removing prevent defaults from any onSelect logic for NavItem, Panel, and PanelGroup * adding tests for Panel and NavItem changes. testing for whether preventDefault is clicked and for whether the navbar collapses when it is clicked. * part of the fix for #2711, removing preventDefault for onSelect. also modifying code so it only will preventDefault if element is disabled * refactoring the fix for issue #2711 * figured this test was unnecessary. also fixed some linting errors. for #2711 * merge issues * fix lint
* Rework Panel API (#1769) * Upgrade `uncontrollable` dependency * remove createClass in tests (#2586) * remove createClass in tests * fix-lint * update changelog * Release v0.31.0 * Add toggle button components (#2252) I’m tried of rewriting this component all the time :P * Update Dropdown.js (#2615) fix typo * switch to new one (#2621) * Rework Panel API * update * fix up the branch, fix examples * Finish tests * Update PanelHeading.js * prop-types clean up * change collapsible API, finish examples and docs * lint: * clean up nits * nits * remove pagination logic (#2587) * remove pagination logic * Add upgrade path. * Transition group (#2676) * switch to react transition group * Update Modal api * fix tests * bump and fix test * Update package.json * update wording * preventDefault specified to work only for disabled && onSelect; it is a fix for issue #2711 * removing prevent defaults from any onSelect logic for NavItem, Panel, and PanelGroup * adding tests for Panel and NavItem changes. testing for whether preventDefault is clicked and for whether the navbar collapses when it is clicked. * part of the fix for #2711, removing preventDefault for onSelect. also modifying code so it only will preventDefault if element is disabled * refactoring the fix for issue #2711 * figured this test was unnecessary. also fixed some linting errors. for #2711 * merge issues * fix lint * Add up-to-date Bootstrap stylesheets * Add btn-link to storybook, precommit format * Fix toggle buttons * Update toggle prop on ButtonGroup * Use npm registry
* Rework Panel API (#1769) * Upgrade `uncontrollable` dependency * remove createClass in tests (#2586) * remove createClass in tests * fix-lint * update changelog * Release v0.31.0 * Add toggle button components (#2252) I’m tried of rewriting this component all the time :P * Update Dropdown.js (#2615) fix typo * switch to new one (#2621) * Rework Panel API * update * fix up the branch, fix examples * Finish tests * Update PanelHeading.js * prop-types clean up * change collapsible API, finish examples and docs * lint: * clean up nits * nits * remove pagination logic (#2587) * remove pagination logic * Add upgrade path. * Transition group (#2676) * switch to react transition group * Update Modal api * fix tests * bump and fix test * Update package.json * update wording * preventDefault specified to work only for disabled && onSelect; it is a fix for issue #2711 * removing prevent defaults from any onSelect logic for NavItem, Panel, and PanelGroup * adding tests for Panel and NavItem changes. testing for whether preventDefault is clicked and for whether the navbar collapses when it is clicked. * part of the fix for #2711, removing preventDefault for onSelect. also modifying code so it only will preventDefault if element is disabled * refactoring the fix for issue #2711 * figured this test was unnecessary. also fixed some linting errors. for #2711 * merge issues * fix lint * Add up-to-date Bootstrap stylesheets * Add btn-link to storybook, precommit format * Fix toggle buttons * Update toggle prop on ButtonGroup * Use npm registry
I know I'm late to the game here ... but this was a nasty breaking change. We have over 300 usages of in our app so it looks like we are stuck of version 0.31.5 for the foreseeable future. How are other people upgrading to v0.32.0? Is there a jscodeshift script for this change? |
First pass at fixing #983.
I started with the most verbose version of the API. I really hope we can offer something closer to the current API for simple cases, because this is really verbose. In particular the accordion code feels silly, verbose.
Things I don't like about this currently:
panel-title
feels dumb, but an extra component feels worse. If there was anyway to guess the right component to use I would just use that...perhaps we just default it to a div and add titleComponentClass?