import { type Breakpoints, useBreakpoints as vueUseBreakpoints, } from "@vueuse/core"; import { computed } from "vue"; // Deliberately not using `breakpointsTailwind` as exported by `@vueuse/core` as it doesn't pick up custom values from the CSS configuration meaning if we customize the breakpoints at some point, these values wouldn't be correct. const breakpointsTailwind: Breakpoints = { sm: "40rem", md: "48rem", lg: "64rem", xl: "80rem", "2xl": "96rem", }; export function useBreakpoints() { const breakpoints = vueUseBreakpoints(breakpointsTailwind); const currentBreakpoint = breakpoints.current(); const sm = computed(() => currentBreakpoint.value.includes("sm")); const md = computed(() => currentBreakpoint.value.includes("md")); const lg = computed(() => currentBreakpoint.value.includes("lg")); const xl = computed(() => currentBreakpoint.value.includes("xl")); const twoXl = computed(() => currentBreakpoint.value.includes("2xl")); return { currentBreakpoint, sm, md, lg, xl, "2xl": twoXl }; }