diff --git a/composables/useDevice.ts b/composables/useDevice.ts new file mode 100644 index 000000000..2259168da --- /dev/null +++ b/composables/useDevice.ts @@ -0,0 +1,19 @@ +import { useGrid, useScreen } from 'vue-screen' + +export default function (): ComputedRef<{ + smallScreen: boolean + touch: boolean + phone: boolean +}> { + const screen = useScreen() + const grid = useGrid('tailwind') + + const device = computed(() => ({ + smallScreen: !grid.md, + touch: screen.touch, + // Quick heuristic for device havng phone capability + phone: screen.touch && !grid.lg, + })) + + return device +}