design: update comment sizing
This commit is contained in:
9 files changed
+23
-31
No files matched your search
@@ -1,12 +1,20 @@
|
||||
<script lang="ts">
|
||||
let { children } = $props()
|
||||
import type { Snippet } from 'svelte'
|
||||
|
||||
let {
|
||||
showLabel = false,
|
||||
children,
|
||||
}: { showLabel?: boolean; children: Snippet } = $props()
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="text-slate-800 dark:text-zinc-200 text-xs font-medium m-3 my-2 mb-1 flex items-center gap-1"
|
||||
>
|
||||
<div class="sr-only">{@render children?.()}</div>
|
||||
<div class={[!showLabel && 'sr-only']}>{@render children?.()}</div>
|
||||
<hr
|
||||
class="shrink flex-1 border-slate-100 dark:border-zinc-800 border-opacity-70 -mx-4"
|
||||
class={[
|
||||
'shrink flex-1 border-slate-100 dark:border-zinc-800',
|
||||
!showLabel && '-mx-4',
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
@@ -68,30 +68,14 @@
|
||||
strategy: strategy,
|
||||
placement: placement,
|
||||
middleware: middleware,
|
||||
onComputed: ({ x, y, placement }) => {
|
||||
onComputed: ({ placement }) => {
|
||||
if (popoverEl) {
|
||||
popoverEl.style.transformOrigin = origins[placement]
|
||||
}
|
||||
|
||||
console.log(placement)
|
||||
|
||||
// @ts-expect-error svelte hell
|
||||
Object.assign(el?.children?.item?.(0) ?? el, {
|
||||
top: '0',
|
||||
left: '0',
|
||||
transform: `translate3d(${roundByDPR(x)}px,${roundByDPR(y)}px,0)`,
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
function roundByDPR(value: number) {
|
||||
const dpr = window.devicePixelRatio || 1
|
||||
return Math.round(value * dpr) / dpr
|
||||
}
|
||||
|
||||
const customFloatingContent = (node: HTMLDivElement) => {
|
||||
// if (!canUseContents) return
|
||||
|
||||
floatingContent(node)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user