chore: cleanup (#17284)

This commit is contained in:
Adam 2026-03-13 06:27:58 -05:00 committed by GitHub
commit 270cb0b8b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 516 additions and 357 deletions

View file

@ -1,5 +1,6 @@
import type { JSX } from "solid-js"
import { createEffect, createSignal, onCleanup, onMount } from "solid-js"
import { createEffect, onCleanup, onMount } from "solid-js"
import { createStore } from "solid-js/store"
import { useSpring } from "./motion-spring"
export function TextStrikethrough(props: {
@ -19,12 +20,16 @@ export function TextStrikethrough(props: {
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)