From 19091058e0397b4f068239187f401788c60475db Mon Sep 17 00:00:00 2001 From: saboooor Date: Thu, 20 Jun 2024 20:29:26 -0600 Subject: [PATCH] show nothing in preview if nothing is typed --- src/routes/resources/animtab/index.tsx | 7 +++---- src/routes/resources/rgb/index.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/routes/resources/animtab/index.tsx b/src/routes/resources/animtab/index.tsx index 7319a166..fe6cbe74 100644 --- a/src/routes/resources/animtab/index.tsx +++ b/src/routes/resources/animtab/index.tsx @@ -146,13 +146,12 @@ export default component$(() => { 'font-mc-bold-italic': store.bold && store.italic, }}> {(() => { - const text = store.text != '' ? store.text : 'birdflop'; + if (!store.text || !tmpstore.frames[0]) return '\u00A0'; - if (!tmpstore.frames[0]) return; const colors = tmpstore.frames[tmpstore.frame]; - if (!colors) return; + if (!colors) return '\u00A0'; - return text.split('').map((char: string, i: number) => ( + return store.text.split('').map((char: string, i: number) => ( { 'font-mc-bold-italic': store.bold && store.italic, }}> {(() => { - const text = store.text ? store.text : 'birdflop'; + if (!store.text) return '\u00A0'; const colors = sortColors(store.colors).map((color) => ({ rgb: convertToRGB(color.hex), pos: color.pos })); - if (colors.length < 2) return text; + if (colors.length < 2) return store.text; - const gradient = new Gradient(colors, text.length); + const gradient = new Gradient(colors, store.text.length); let hex = ''; - return text.split('').map((char: string, i: number) => { + return store.text.split('').map((char: string, i: number) => { if (store.trimspaces && char == ' ') gradient.next(); else hex = convertToHex(gradient.next()); return (