Sha256: e011be8c45022c034c88f6185663ce8024ba33be64ea9126632d411ba54e006f
Contents?: true
Size: 715 Bytes
Versions: 3
Compression:
Stored size: 715 Bytes
Contents
import tokens from "@config/tokens.cjs"; import { CocoComponent } from "@assets/js/base/coco"; const mobileMaxWidth = parseInt(tokens.screens.sm, 10); export default CocoComponent("appSidebarNav", () => { return { sizeObserver: null, mobileLayout: true, init() { this.sizeObserver = new ResizeObserver( Alpine.throttle((entries) => { this.$nextTick(() => { const bodyWidth = entries[0].contentRect.width; this.mobileLayout = bodyWidth < mobileMaxWidth; }); }, 20) ); this.sizeObserver.observe(document.documentElement); }, destroy() { this.sizeObserver && this.sizeObserver.disconnect(); }, }; });
Version data entries
3 entries across 3 versions & 1 rubygems