()
| 70 | ]; |
| 71 | |
| 72 | const ASCIITextDemo = () => { |
| 73 | const { props, updateProp, resetProps, hasChanges } = useComponentProps(DEFAULT_PROPS); |
| 74 | const { text, enableWaves, asciiFontSize } = props; |
| 75 | |
| 76 | const [key, forceRerender] = useForceRerender(); |
| 77 | const dependencyList = useMemo(() => ['three'], []); |
| 78 | |
| 79 | useEffect(() => { |
| 80 | forceRerender(); |
| 81 | }, [forceRerender]); |
| 82 | |
| 83 | return ( |
| 84 | <ComponentPropsProvider props={props} defaultProps={DEFAULT_PROPS} resetProps={resetProps} hasChanges={hasChanges}> |
| 85 | <TabsLayout> |
| 86 | <PreviewTab> |
| 87 | <Box position="relative" className="demo-container" minH={400} maxH={400} overflow="hidden" mb={6}> |
| 88 | <ASCIIText |
| 89 | key={key} |
| 90 | text={text} |
| 91 | enableWaves={enableWaves} |
| 92 | asciiFontSize={asciiFontSize} |
| 93 | textFontSize={250} |
| 94 | planeBaseHeight={12} |
| 95 | /> |
| 96 | </Box> |
| 97 | |
| 98 | <Customize> |
| 99 | <PreviewInput |
| 100 | title="Text" |
| 101 | value={text} |
| 102 | placeholder="Enter text..." |
| 103 | width={200} |
| 104 | maxLength={10} |
| 105 | onChange={val => updateProp('text', val)} |
| 106 | /> |
| 107 | |
| 108 | <PreviewSlider |
| 109 | title="Size" |
| 110 | min={1} |
| 111 | max={64} |
| 112 | step={1} |
| 113 | value={asciiFontSize} |
| 114 | onChange={val => { |
| 115 | updateProp('asciiFontSize', Number(val) || 1); |
| 116 | forceRerender(); |
| 117 | }} |
| 118 | /> |
| 119 | |
| 120 | <PreviewSwitch |
| 121 | title="Waves" |
| 122 | isChecked={enableWaves} |
| 123 | onChange={checked => { |
| 124 | updateProp('enableWaves', checked); |
| 125 | forceRerender(); |
| 126 | }} |
| 127 | /> |
| 128 | </Customize> |
| 129 |
nothing calls this directly
no test coverage detected