diff --git a/src/components/CodeSnippet/index.svelte b/src/components/CodeSnippet/index.svelte new file mode 100644 index 00000000..cdff9155 --- /dev/null +++ b/src/components/CodeSnippet/index.svelte @@ -0,0 +1,9 @@ + + +
+ {@html marked("```js\n" + code + "\n```")} +
diff --git a/src/components/Course/components/Lecture/Homework/EditMode.svelte b/src/components/Course/components/Lecture/Homework/EditMode.svelte index 37edccd0..da8269af 100644 --- a/src/components/Course/components/Lecture/Homework/EditMode.svelte +++ b/src/components/Course/components/Lecture/Homework/EditMode.svelte @@ -2,9 +2,9 @@ import { questionnaire, handleAddOption, - handleAddQuestion, handleRemoveOption, handleRemoveQuestion, + handleCode, } from "./store/index"; import Delete24 from "carbon-icons-svelte/lib/Delete24"; import AddFilled24 from "carbon-icons-svelte/lib/AddFilled24"; @@ -14,9 +14,10 @@ import Checkbox from "../../../../Form/Checkbox.svelte"; import RadioItem from "../../../../Form/RadioItem.svelte"; import IconButton from "../../../../IconButton/index.svelte"; - import Select from "../../../../Form/Select.svelte"; import PrimaryButton from "../../../../PrimaryButton/index.svelte"; + import Dropdown from "../../../../Dropdown/index.svelte"; import { VARIANTS } from "../../../../PrimaryButton/constants"; + import Select from "../../../../Form/Select.svelte"; import QuestionContainer from "../../../../QuestionContainer/index.svelte"; import { QUESTION_TYPE, @@ -26,39 +27,83 @@ // import readme from "../../readme.js"; // let value = readme; + const extraActions = ["Code Snippets", "Upload image"]; + const initialQuestionsLength = $questionnaire.questions.length; + + function shouldScrollToLast(index, questions) { + const currentQuestionsLength = questions.length; + const isLast = index + 1 === currentQuestionsLength; + + return isLast && initialQuestionsLength !== currentQuestionsLength; + } + + function handleOptionClick(questionIndex) { + return (actionIndex) => { + switch (actionIndex) { + case 0: + handleCode(questionIndex, true); + break; + case 1: + // uploadImage(questionIndex); + break; + default: + console.log("No option"); + } + }; + } -
-
-

Home task

- -
- +
- - +