|
|
|
@ -15,9 +15,11 @@ const SlideItem = ({item}) => { |
|
|
|
|
const {basePath} = useContext(SlideContext); |
|
|
|
|
|
|
|
|
|
const content = useMemo(() => { |
|
|
|
|
|
|
|
|
|
switch (item.type) { |
|
|
|
|
case "heading": |
|
|
|
|
switch(item.level) { |
|
|
|
|
const level = item.level || item.depth; |
|
|
|
|
switch(level) { |
|
|
|
|
case 1: |
|
|
|
|
return <h1><Children items={item.tokens} /></h1> |
|
|
|
|
case 2: |
|
|
|
@ -28,6 +30,7 @@ const SlideItem = ({item}) => { |
|
|
|
|
return <h4><Children items={item.tokens} /></h4> |
|
|
|
|
case 5: |
|
|
|
|
default: |
|
|
|
|
console.log("UNKNOWN LEVEL", item); |
|
|
|
|
return <h5><Children items={item.tokens} /></h5> |
|
|
|
|
} |
|
|
|
|
case "list": |
|
|
|
@ -59,10 +62,12 @@ const SlideItem = ({item}) => { |
|
|
|
|
return <b><Children items={item.tokens} /></b> |
|
|
|
|
case "em": |
|
|
|
|
return <i><Children items={item.tokens} /></i> |
|
|
|
|
case "html": |
|
|
|
|
return <span dangerouslySetInnerHTML={{__html : item.raw}}></span> |
|
|
|
|
case "text": |
|
|
|
|
return <>{item.tokens ? <Children items={item.tokens} /> : item.text}</> |
|
|
|
|
default: |
|
|
|
|
return JSON.stringify("UNKNOWN ITEM", item); |
|
|
|
|
return "UNKNOWN ITEM" + JSON.stringify(item); |
|
|
|
|
} |
|
|
|
|
}, [item, basePath]); |
|
|
|
|
|
|
|
|
|