Skip to content

Commit 2aa1741

Browse files
committed
Refactor SlidingTextBox: encapsulate initialize function and remove unused updateHeight function
1 parent f9ee4d6 commit 2aa1741

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/components/SlidingTextBox.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useRef } from "react";
22
import styles from "./SlidingTextBox.module.css";
33

4-
export const initialize = (containerBox: HTMLElement) => {
4+
const initialize = (containerBox: HTMLElement) => {
55
const resizeObserver = new ResizeObserver((_) => {
66
containerBox.style.minHeight = contentBox?.scrollHeight + "px";
77
});
@@ -17,11 +17,6 @@ export const initialize = (containerBox: HTMLElement) => {
1717
};
1818
};
1919

20-
export const updateHeight = (containerBox: HTMLElement) => {
21-
const contentBox = containerBox.querySelector<HTMLElement>("." + styles.contentBox);
22-
containerBox.style.minHeight = contentBox?.scrollHeight + "px";
23-
};
24-
2520
export const SlidingTextBox = ({ text }: { text: string }) => {
2621
const containerBoxRef = useRef<HTMLDivElement>(null);
2722
const initialRendering = useRef(true);

0 commit comments

Comments
 (0)