Skip to content

Commit

Permalink
chore: update breakpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 20, 2024
1 parent fc2ac39 commit 5d8774e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 8 additions & 1 deletion packages/core/useBreakpoints/breakpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const breakpointsBootstrapV5 = {
*
* @see https://v2.vuetifyjs.com/en/features/breakpoints/
*/
export const breakpointsVuetify = {
export const breakpointsVuetifyV2 = {
xs: 0,
sm: 600,
md: 960,
Expand All @@ -52,6 +52,13 @@ export const breakpointsVuetifyV3 = {
xxl: 2560,
}

/**
* Alias to `breakpointsVuetifyV2`
*
* @deprecated explictly use `breakpointsVuetifyV2` or `breakpointsVuetifyV3` instead
*/
export const breakpointsVuetify = breakpointsVuetifyV2

/**
* Breakpoints from Ant Design
*
Expand Down
4 changes: 2 additions & 2 deletions packages/core/useBreakpoints/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const reactiveStuff = ref<keyof typeof breakpointsTailwind>('sm')
const isGreaterThanBreakpoint = breakpoints.greaterOrEqual(() => reactiveStuff.value)
const current = breakpoints.current()
const mode = breakpoints.mode()
const active = breakpoints.active()
const xs = breakpoints.smaller('sm')
const xse = breakpoints.smallerOrEqual('sm')
const sm = breakpoints.between('sm', 'md')
Expand All @@ -23,7 +23,7 @@ const xxl = breakpoints['2xl']
<template>
<div class="font-mono">
<div> Current breakpoints: {{ current }} </div>
<div> Current screen mode: {{ mode }} </div>
<div> Active breakpoint: {{ active }} </div>
<div> xs(&lt;{{ smWidth }}px): <BooleanDisplay :value="xs" /></div>
<div> xs(&lt;={{ smWidth }}px): <BooleanDisplay :value="xse" /></div>
<div> sm: <BooleanDisplay :value="sm" /></div>
Expand Down
4 changes: 1 addition & 3 deletions packages/core/useBreakpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ export function useBreakpoints<K extends string>(breakpoints: Breakpoints<K>, op
current,
active() {
const bps = current()
return computed(() => {
return bps.value.length === 0 ? '' : bps.value.at(-1)
})
return computed(() => bps.value.length === 0 ? '' : bps.value.at(-1))
},
})
}
Expand Down

0 comments on commit 5d8774e

Please sign in to comment.