Skip to content

Commit

Permalink
fix(related-prompts-tag-list): fix ts types
Browse files Browse the repository at this point in the history
  • Loading branch information
C4rlos99 committed Jan 29, 2025
1 parent 41a7d4f commit 38fc7bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion packages/x-components/src/directives/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ function execute(el: TypingHTMLElement, options: TypingOptions) {
}

let index = 0;
el.__timeoutId = el.__timeoutId || undefined;

const updateContent = (value: string) => {
if (targetAttr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
]);
const relatedPromptComponents = ref<InstanceType<typeof RelatedPrompt>[]>([]);
const relatedPromptElements = computed(() =>
const relatedPromptElements = computed<HTMLElement[]>(() =>
relatedPromptComponents.value.map(component => component.$el)
);
const initialOffsetLefts: Record<number, number> = {};
Expand Down Expand Up @@ -122,7 +122,7 @@
const onSelect = (selectedIndex: number): void => {
resetRelatedPromptsStyle();
const selected = relatedPromptElements.value.find(
const selected: HTMLElement = relatedPromptElements.value.find(
element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex
)!;
selected.style.transition = 'all';
Expand All @@ -144,13 +144,15 @@
selected.style.transitionDelay = `${
(relatedPrompts.value.length - 2) * singleAnimationDurationInMs.value
}ms`;
requestAnimationFrame(() => {
selected.style.left = '0px';
const maxWidth = getComputedStyle(selected).maxWidth;
selected.style.setProperty(
'width',
`${getComputedStyle(selected).maxWidth}`,
`${maxWidth !== 'none' ? maxWidth : '100%'}`,
'important'
);
selected.style.left = '0px';
});
} else {
selected.style.removeProperty('width');
Expand All @@ -177,12 +179,6 @@
element.style.transitionDelay = `${
(index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value
}ms`;
console.log(
'Delay',
index,
(index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value
);
element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;
element.style.position = 'absolute';
element.style.left = `${initialOffsetLefts[index]}px`;
Expand Down

0 comments on commit 38fc7bd

Please sign in to comment.