Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Bulbs truncate element #249

Merged
merged 10 commits into from
Feb 15, 2017
Merged

Bulbs truncate element #249

merged 10 commits into from
Feb 15, 2017

Conversation

shawncook
Copy link
Contributor

@shawncook shawncook commented Feb 14, 2017

@shawncook shawncook self-assigned this Feb 15, 2017
@@ -0,0 +1,27 @@
.bulbs-truncate-element-parent-active {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works great. Maybe we can add a transition here? Would be a little nicer if we had a slight animation on the height of the active class or opacity attribute of the :after element. Maybe both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving off the animation because it's not quick and easy to animate between max-height:1000px and max-height:auto. We can come back to this after QA has a look at the functionality.

@jmelvnsn
Copy link
Contributor

Other than small comment. lgtm

}
}

.bulbs-truncate-element-button {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could add outline: none here to prevent that annoying blue border when clicking

Copy link
Contributor

@collin collin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice element :)

this.openElement = this.openElement.bind(this);
this.addButton();
this.addEventListener('click', this.openElement);
$(this).prev().addClass('bulbs-truncate-element-parent-active');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of native dom methods in this element, another two apis we can use here

this.previousElementSibling

and element.classList

Together we can use them like:

let previousEl = this.previousElementSibling;
if (previousEl) {
  previousEl.classList.add('bulbs-truncate-element-parent-active');
  previousEl.classList.remove('bulbs-truncate-element-parent-active');
}

Doing this now will help when we start migrating these components over to the gawkermedia/kinja-components repository which does not include jQuery as a depency.

@shawncook shawncook merged commit 8b3ec12 into master Feb 15, 2017
@shawncook shawncook deleted the bulbs-truncate-element branch February 15, 2017 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants