Autohide crumb container when empty
djsegal opened this issue · comments
if you use breadCrumb: null
on the first couple (sub)routes, you can end up with an empty crumb container.
it might be nice to autohide it in that case
edit:
having just one crumb is kind of annoying too. it might be nice to have:
- a
crumbThreshold
- a
firstCrumbRoute
- or something else
@djsegal you can extend the default bread-crumbs component by defining app/components/bread-crumbs.js
which would inherit from ember-crumbly/components/bread-crumbs
.
You can then add additional classes or other functionality as needed. For example add a hidden
class to the component when the routeHierarchy
is empty
import Ember from 'ember';
import BreadCrumbs from 'ember-crumbly/components/bread-crumbs';
const { computed } = Ember;
export default BreadCrumbs.extend({
bindClassNames: ['hidden'],
hidden: computed.empty('routeHierarchy')
})
If you think this should be part of ember-crumbly please submit a pull request for consideration.
I tried the example above, but I am new to ember and it doesn't seem to work for me.
BTW in CSS3 there is an :empty
pseudo-selector that you can use for the list like so:
.breadcrumb:empty {
display: none;
}
But the problem is that it doesn't work if element has white-spaces.
If we could remove white-spaces from crumbly than this would work.
P.S. When CSS4 comes out, the :blank
should solve white-space issue.