Skip to content

Commit

Permalink
chore(ai-chat-log): linting
Browse files Browse the repository at this point in the history
  • Loading branch information
krisantrobus committed Dec 19, 2024
1 parent 59470a6 commit 7cf6a46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { HTMLPasteProps } from "@twilio-paste/types";
import * as React from "react";

import { AIMessageContext } from "./AIMessageContext";
import useAnimatedText from "./utils";
import { useAnimatedText } from "./utils";

const Sizes: Record<string, BoxStyleProps> = {
default: {
Expand Down
8 changes: 4 additions & 4 deletions packages/paste-core/components/ai-chat-log/src/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export const useAnimatedText = (children: React.ReactNode, speed = 10): React.Re
}, [speed]);

// Function to calculate the total length of text within nested elements
const calculateTotalTextLength = (children: React.ReactNode): number => {
const calculateTotalTextLength = (nodes: React.ReactNode): number => {
let length = 0;
React.Children.forEach(children, (child) => {
React.Children.forEach(nodes, (child) => {
if (typeof child === "string") {
length += child.length;
} else if (React.isValidElement(child)) {
Expand All @@ -28,9 +28,9 @@ export const useAnimatedText = (children: React.ReactNode, speed = 10): React.Re
};

// Function to recursively clone children and apply text animation
const cloneChildren = (children: React.ReactNode, currentIndex: number): React.ReactNode => {
const cloneChildren = (nodes: React.ReactNode, currentIndex: number): React.ReactNode => {
let currentTextIndex = currentIndex;
return React.Children.map(children, (child) => {
return React.Children.map(nodes, (child) => {
if (typeof child === "string") {
// Only include text nodes if their animation has started
if (currentTextIndex > 0) {
Expand Down

0 comments on commit 7cf6a46

Please sign in to comment.