chore: cleanup (#17284)
This commit is contained in:
parent
46ba9c8170
commit
270cb0b8b4
23 changed files with 516 additions and 357 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue