Skip to content

Commit

Permalink
tried to fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
goldy1992 committed Nov 19, 2023
1 parent 87d961d commit 2106db4
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions app/components/code_block/renderer.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import React, { useState } from 'react'
import React from 'react'
import ICodeState from './ICodeState'


export default function CodeRenderer({codeState} : {codeState: ICodeState}) : React.ReactNode {

//const [currentRenderIdx, setCurrentRenderIdx] = useState(codeState.currentIndex)
const renders = [
( <></>),
(
<div><span className='text-gray-800 dark:text-gray-200'>Hello World</span></div>
),

(
<div className='flex h-full flex-col justify-center'>
<div className='w-full flex flex-row justify-center'>
<span className='text-gray-800 dark:text-gray-200'>Hello World</span>
</div>
let rendererIdx = codeState.canRender ? codeState.currentIndex + 1 : codeState.currentIndex

switch(rendererIdx) {
case 0: return (
<></>
)
case 1: return (
<div>
<span className='text-gray-800 dark:text-gray-200'>
Hello World
</span>
</div>
)
]
let rendererIdx = codeState.canRender ? codeState.currentIndex + 1 : codeState.currentIndex

return renders[rendererIdx]
default: return (
<div key={2} className='flex h-full flex-col justify-center'>
<div className='w-full flex flex-row justify-center'>
<span className='text-gray-800 dark:text-gray-200'>Hello World</span>
</div>
</div>
)
}
}

0 comments on commit 2106db4

Please sign in to comment.