change login-page design
This commit is contained in:
@@ -17,6 +17,10 @@ type DraggableFloatingOptions = {
|
||||
/** فاصله از پایینِ نوار منو + montzar (px) — مثل تصویر */
|
||||
defaultBottomGap?: number
|
||||
defaultRightOffset?: number
|
||||
/** عرض کل پنجره بهجای فریم موبایل ۴۲۶ */
|
||||
fullViewport?: boolean
|
||||
/** نوار پایین اپ را در موقعیت پیشفرض لحاظ نکن */
|
||||
ignoreBottomChrome?: boolean
|
||||
}
|
||||
|
||||
function readBottomChromeHeight(): number {
|
||||
@@ -49,6 +53,8 @@ export function useDraggableFloatingButton(
|
||||
const height = options.height ?? 44
|
||||
const defaultBottomGap = options.defaultBottomGap ?? 12
|
||||
const defaultRightOffset = options.defaultRightOffset ?? 16
|
||||
const fullViewport = options.fullViewport === true
|
||||
const ignoreBottomChrome = options.ignoreBottomChrome === true
|
||||
|
||||
const pos = ref<FabPosition>({ x: 0, y: 0 })
|
||||
const dragging = ref(false)
|
||||
@@ -68,6 +74,7 @@ export function useDraggableFloatingButton(
|
||||
}))
|
||||
|
||||
function getViewportWidth() {
|
||||
if (fullViewport) return window.innerWidth
|
||||
return Math.min(window.innerWidth, 426)
|
||||
}
|
||||
|
||||
@@ -78,11 +85,16 @@ export function useDraggableFloatingButton(
|
||||
return Math.max(0, (vw - contentWidth) / 2)
|
||||
}
|
||||
|
||||
function getBottomChrome() {
|
||||
if (ignoreBottomChrome) return 0
|
||||
return readBottomChromeHeight()
|
||||
}
|
||||
|
||||
function getDefaultPosition(): FabPosition {
|
||||
const vh = window.innerHeight
|
||||
const offsetX = getHorizontalOffset()
|
||||
const contentWidth = getViewportWidth()
|
||||
const bottomChrome = readBottomChromeHeight()
|
||||
const bottomChrome = getBottomChrome()
|
||||
|
||||
return {
|
||||
x: offsetX + contentWidth - width - defaultRightOffset,
|
||||
|
||||
Reference in New Issue
Block a user