app/assets/lookbook/js/components/sidebar.js in lookbook-0.6.1 vs app/assets/lookbook/js/components/sidebar.js in lookbook-0.7.0
- old
+ new
@@ -1,3 +1,18 @@
export default function sidebar() {
- return {};
+ return {
+ init() {
+ this.$nextTick(() => this.setActiveNavItem());
+ },
+ setActiveNavItem() {
+ const target = this.$el.querySelector(
+ `[data-path="${window.location.pathname}"]`
+ );
+ this.$store.nav.active = target ? target.id : "";
+ },
+ setSplits(splits) {
+ if (splits.length) {
+ this.$store.sidebar.panelSplits = [splits[0] || 1.0, splits[2] || 1.0];
+ }
+ },
+ };
}