chore: cleanup (#17284)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// @ts-nocheck
|
||||
import { createEffect, createSignal, onCleanup, onMount } from "solid-js"
|
||||
import { createStore } from "solid-js/store"
|
||||
import { useSpring } from "./motion-spring"
|
||||
import { TextStrikethrough } from "./text-strikethrough"
|
||||
|
||||
@@ -130,12 +131,16 @@ function VariantF(props: { active: boolean; text: string }) {
|
||||
)
|
||||
let baseRef: HTMLSpanElement | undefined
|
||||
let containerRef: HTMLSpanElement | undefined
|
||||
const [textWidth, setTextWidth] = createSignal(0)
|
||||
const [containerWidth, setContainerWidth] = createSignal(0)
|
||||
const [state, setState] = createStore({
|
||||
textWidth: 0,
|
||||
containerWidth: 0,
|
||||
})
|
||||
const textWidth = () => state.textWidth
|
||||
const containerWidth = () => state.containerWidth
|
||||
|
||||
const measure = () => {
|
||||
if (baseRef) setTextWidth(baseRef.scrollWidth)
|
||||
if (containerRef) setContainerWidth(containerRef.offsetWidth)
|
||||
if (baseRef) setState("textWidth", baseRef.scrollWidth)
|
||||
if (containerRef) setState("containerWidth", containerRef.offsetWidth)
|
||||
}
|
||||
|
||||
onMount(measure)
|
||||
|
||||
Reference in New Issue
Block a user