parent
e21679ee1f
commit
d5708709d2
9 changed files with 127 additions and 12 deletions
@ -0,0 +1,3 @@ |
||||
@function color($color) { |
||||
@return var(--color-#{$color}); |
||||
} |
@ -0,0 +1,14 @@ |
||||
*::-webkit-scrollbar { |
||||
width: 4px; |
||||
} |
||||
|
||||
*::-webkit-scrollbar-track { |
||||
background: color(background); |
||||
} |
||||
|
||||
*::-webkit-scrollbar-thumb { |
||||
background-color: color(scrollbar); |
||||
border-radius: 20px; |
||||
border: solid 4px color(background); |
||||
padding: 2px; |
||||
} |
@ -0,0 +1,5 @@ |
||||
.slide { |
||||
user-select: none; |
||||
background: color(background); |
||||
color: color(foreground); |
||||
} |
@ -1,4 +1,5 @@ |
||||
.slides-list { |
||||
background: #222; |
||||
//background: #222; |
||||
background: color(lighterBackground); |
||||
overflow-y: auto; |
||||
} |
@ -0,0 +1,13 @@ |
||||
$colors : ( |
||||
//background : #272822, |
||||
background : #1a1a1a, |
||||
foreground : #ddd, |
||||
lighterBackground : #333, |
||||
scrollbar : rgba(255,255,255,0.2) |
||||
); |
||||
|
||||
:root { |
||||
@each $colorName, $colorValue in $colors { |
||||
--color-#{$colorName} : #{$colorValue}; |
||||
} |
||||
} |
@ -0,0 +1,76 @@ |
||||
import React, {useMemo} from "react"; |
||||
|
||||
import SyntaxHighlighter from "react-syntax-highlighter" |
||||
import {monokai} from "react-syntax-highlighter/dist/esm/styles/hljs"; |
||||
|
||||
const Children = ({items}) => { |
||||
if (items instanceof Array) |
||||
return <>{items.map((child, index) => <SlideItem item={child} key={index} />)}</>; |
||||
return null; |
||||
}; |
||||
|
||||
const SlideItem = ({item}) => { |
||||
const content = useMemo(() => { |
||||
console.log("ITEM",item); |
||||
switch (item.type) { |
||||
case "heading": |
||||
return <h1><Children items={item.tokens} /></h1> |
||||
case "list": |
||||
if (item.ordered) |
||||
return <ol><Children items={item.items} /></ol> |
||||
else |
||||
return <ul><Children items={item.items} /></ul> |
||||
case "list_item": |
||||
const prefix = item.task ? <input type="checkbox" defaultChecked={item.checked} /> : null; |
||||
return <li>{prefix} <Children items={item.tokens} /></li> |
||||
case "paragraph": |
||||
return <p><Children items={item.tokens} /></p> |
||||
case "code": |
||||
return <SyntaxHighlighter style={monokai} language={item.lang}>{item.text}</SyntaxHighlighter> |
||||
case "strong": |
||||
return <b><Children items={item.tokens} /></b> |
||||
case "text": |
||||
return <>{item.text}</> |
||||
default: |
||||
return JSON.stringify(item); |
||||
} |
||||
}, [item]); |
||||
|
||||
return ( |
||||
<> |
||||
{content} |
||||
</> |
||||
); |
||||
}; |
||||
|
||||
export default SlideItem; |
||||
|
||||
/* { |
||||
"type": "paragraph", |
||||
"raw": "This is a very fancy **bold** keynote", |
||||
"text": "This is a very fancy **bold** keynote", |
||||
"tokens": [ |
||||
{ |
||||
"type": "text", |
||||
"raw": "This is a very fancy ", |
||||
"text": "This is a very fancy " |
||||
}, |
||||
{ |
||||
"type": "strong", |
||||
"raw": "**bold**", |
||||
"text": "bold", |
||||
"tokens": [ |
||||
{ |
||||
"type": "text", |
||||
"raw": "bold", |
||||
"text": "bold" |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
"type": "text", |
||||
"raw": " keynote", |
||||
"text": " keynote" |
||||
} |
||||
] |
||||
} */ |
Loading…
Reference in new issue