quiz
This commit is contained in:
21
src/pages/CodeSnippetPage.js
Normal file
21
src/pages/CodeSnippetPage.js
Normal file
@ -0,0 +1,21 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
||||
import { a11yDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
||||
|
||||
export const CodeSnippetlighter = () => {
|
||||
const [codeString, setCodeString] = useState(``)
|
||||
|
||||
useEffect(()=>{
|
||||
fetch('/code.txt')
|
||||
.then((r) => r.text())
|
||||
.then(text => {
|
||||
setCodeString(text)
|
||||
})
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<SyntaxHighlighter language={"javascript"} style={a11yDark} wrapLongLines={false} customStyle={{fontSize:14}} showLineNumbers={true}>
|
||||
{codeString}
|
||||
</SyntaxHighlighter>
|
||||
);
|
||||
};
|
1
src/pages/code.txt
Normal file
1
src/pages/code.txt
Normal file
@ -0,0 +1 @@
|
||||
Hellow
|
@ -0,0 +1,23 @@
|
||||
import {Link, Redirect} from "react-router-dom"
|
||||
import {HeaderPageTestsQuiz} from "../../components/features/quiz/HeaderPageTests"
|
||||
import {Results} from "../../components/features/quiz/Results";
|
||||
import {useSelector} from "react-redux";
|
||||
import {selectedTest} from "../../redux/quizSlice";
|
||||
import React from "react";
|
||||
|
||||
|
||||
export const ResultPage = () => {
|
||||
|
||||
const test = useSelector(selectedTest)
|
||||
|
||||
if (!test) {
|
||||
return <Redirect to={'/quiz'}/>
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<HeaderPageTestsQuiz isVisibilityButton={false}/>
|
||||
<Results/>
|
||||
</>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user