-
Notifications
You must be signed in to change notification settings - Fork 29
Conversation
src/cf-expandables/src/Expandable.js
Outdated
const contains = domClassList.contains; | ||
const addClass = domClassList.addClass; | ||
const closest = require( 'cf-atomic-component/src/utilities/dom-closest' ).closest; | ||
const removeClass = domClassList.removeClass; |
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.
Nitpicky, but lets group all the domClassList
child vars together.
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.
Fixed
src/cf-expandables/src/Expandable.js
Outdated
this.transition.toggleExpandable(); | ||
this.toggleTargetState( this.ui.target ); | ||
}, | ||
transition: null, |
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.
Should these values down to L:43 be left aligned to stay consistent with the objects above?
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.
Fixed
function initialize() { | ||
const customClasses = { | ||
BASE_CLASS: 'o-expandable_content__transition', | ||
EXPANDED: 'o-expandable_content__expanded', |
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.
EXPANDED
and COLLAPSED
are defined in the classes
object. Should they be saved as constants at the top of the file?
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.
Hmm, that's a good point! Let's revisit that in #665, lest I break some existing functionality here.
const transition = new ExpandableTransition( this.ui.content, customClasses ); | ||
this.transition = transition.init(); | ||
|
||
const groupElement = closest( this.ui.target, '.' + this.classes.groupAccordion ); |
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.
Outside the scope, but if we're deciding all expandables should be in a group organism, should we target and initialize on the group instead of the individual expandables? It might make this a bit more efficient because we wouldn't have to lookup the group a whole bunch of times.
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.
Totally! I think everything would move to the group so we could eliminate the closest
helper. (Related issue #665)
src/cf-tables/src/TableRowLinks.js
Outdated
}; | ||
target = closest( event.target, 'tr' ); | ||
const link = target.querySelector( 'a' ); | ||
if ( link ) window.location = link.getAttribute( 'href' ); |
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 should be wrapped in curly braces to match the return on L:31
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.
Fixed
* Function used to create computed and triggered properties. | ||
*/ | ||
function initialize() { | ||
this.sortClass = UNDEFINED; |
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.
Should these be part of a customClasses
object like in the Expandables code instead of properties?
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 looks like a different use case. In Expandables there's a set of class names that are assigned to constants that are only used inside the initialize
method, so their scope is fine. In this case, sortClass
is not constant and is used across methods, so is assigned as a property to share between methods. Personally I prefer not to expose anything publicly that is not needed in the public API, lest it leads to unintended implementations, so if sortClass
could be internal that would be better (such as by moving it's location above the scope of the TableSortable object), but I don't think that's currently possible here as the methods here get added to instances of the Table organism, so that if sortClass
was in a higher scope it would then become shared among all Table organisms using the TableSortable modifier. Is that right @sebworks?
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.
yep, that is correct @anselmbradford
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.
Hmm, sidenote that my renaming these capitalized like they are classes when they're not instantiating new instances is possibly misleading.
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.
nice work
bd54243
to
d5fd939
Compare
d5fd939
to
cd25899
Compare
Changes
Testing