diff --git a/src/ui/src/assets/css/_mixins.scss b/src/ui/src/assets/css/_mixins.scss new file mode 100644 index 0000000..eee4e5f --- /dev/null +++ b/src/ui/src/assets/css/_mixins.scss @@ -0,0 +1,3 @@ +@function color($color) { + @return var(--color-#{$color}); +} \ No newline at end of file diff --git a/src/ui/src/assets/css/_scrollbars.scss b/src/ui/src/assets/css/_scrollbars.scss new file mode 100644 index 0000000..f0297dc --- /dev/null +++ b/src/ui/src/assets/css/_scrollbars.scss @@ -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; +} \ No newline at end of file diff --git a/src/ui/src/assets/css/_slide.scss b/src/ui/src/assets/css/_slide.scss new file mode 100644 index 0000000..b89f3cf --- /dev/null +++ b/src/ui/src/assets/css/_slide.scss @@ -0,0 +1,5 @@ +.slide { + user-select: none; + background: color(background); + color: color(foreground); +} \ No newline at end of file diff --git a/src/ui/src/assets/css/_slidesList.scss b/src/ui/src/assets/css/_slidesList.scss index b72646e..95230b6 100644 --- a/src/ui/src/assets/css/_slidesList.scss +++ b/src/ui/src/assets/css/_slidesList.scss @@ -1,4 +1,5 @@ .slides-list { - background: #222; + //background: #222; + background: color(lighterBackground); overflow-y: auto; } \ No newline at end of file diff --git a/src/ui/src/assets/css/_variables.scss b/src/ui/src/assets/css/_variables.scss new file mode 100644 index 0000000..be95c0f --- /dev/null +++ b/src/ui/src/assets/css/_variables.scss @@ -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}; + } +} \ No newline at end of file diff --git a/src/ui/src/assets/css/ation.scss b/src/ui/src/assets/css/ation.scss index 226669c..65fdfcb 100644 --- a/src/ui/src/assets/css/ation.scss +++ b/src/ui/src/assets/css/ation.scss @@ -1,5 +1,11 @@ + +@import "variables"; +@import "mixins"; +@import "scrollbars"; + @import "window"; @import "slidesList"; +@import "slide"; * { box-sizing: border-box; @@ -12,4 +18,5 @@ html, body { body { margin: 0; padding: 0; + background: color(background); } \ No newline at end of file diff --git a/src/ui/src/components/Ation.js b/src/ui/src/components/Ation.js index 4e93c6b..18b4b59 100644 --- a/src/ui/src/components/Ation.js +++ b/src/ui/src/components/Ation.js @@ -2,6 +2,7 @@ import React, {useEffect, useState} from "react"; import SlidesList from "./SlidesList"; import Modes from "../models/Modes"; +import Slide from "./Slide"; const Ation = () => { const [mode, setMode] = useState(Modes.NORMAL); @@ -46,7 +47,7 @@ const Ation = () => {
- MAIN +
diff --git a/src/ui/src/components/Slide.js b/src/ui/src/components/Slide.js index 3fc875d..6534d9d 100644 --- a/src/ui/src/components/Slide.js +++ b/src/ui/src/components/Slide.js @@ -1,18 +1,13 @@ import React from "react"; +import SlideItem from "./SlideItem"; + const Slide = ({data}) => { - console.log(data); return (
- {data.content.map(item => { - switch (item.type) { - case "heading": - return

{item.raw}

- break; - default: - return JSON.stringify(item); - } - })} + {data?.content.map((item, index) => + + )}
); }; diff --git a/src/ui/src/components/SlideItem.js b/src/ui/src/components/SlideItem.js new file mode 100644 index 0000000..31545e0 --- /dev/null +++ b/src/ui/src/components/SlideItem.js @@ -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) => )}; + return null; +}; + +const SlideItem = ({item}) => { + const content = useMemo(() => { + console.log("ITEM",item); + switch (item.type) { + case "heading": + return

+ case "list": + if (item.ordered) + return
+ else + return + case "list_item": + const prefix = item.task ? : null; + return
  • {prefix}
  • + case "paragraph": + return

    + case "code": + return {item.text} + case "strong": + return + 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" + } + ] +} */ \ No newline at end of file