Skip to content
Snippets Groups Projects
Commit aed81659 authored by chris's avatar chris
Browse files

add new component files

parent 62cb04d6
No related branches found
No related tags found
1 merge request!511Numerical answer
import React from 'react';
const ExactAnswerComponent = () => {
return <>Exact Answer Selected</>;
};
export default ExactAnswerComponent;
...@@ -8,6 +8,9 @@ import { ...@@ -8,6 +8,9 @@ import {
import styled from 'styled-components'; import styled from 'styled-components';
import EditorComponent from '../../MultipleChoiceQuestionService/components/EditorComponent'; import EditorComponent from '../../MultipleChoiceQuestionService/components/EditorComponent';
import FeedbackComponent from '../../MultipleChoiceQuestionService/components/FeedbackComponent'; import FeedbackComponent from '../../MultipleChoiceQuestionService/components/FeedbackComponent';
import ExactAnswerComponent from './ExactAnswerComponent';
import PreciseAnswerComponent from './PreciseAnswerComponent';
import RangeAnswerComponent from './RangeAnswerComponent';
const NumericalAnswerWrapper = styled.div` const NumericalAnswerWrapper = styled.div`
margin: 0px 38px 15px 38px; margin: 0px 38px 15px 38px;
...@@ -53,8 +56,10 @@ const StyledIconActionRemove = styled(Icon)` ...@@ -53,8 +56,10 @@ const StyledIconActionRemove = styled(Icon)`
export default ({ node, view, getPos }) => { export default ({ node, view, getPos }) => {
const context = useContext(WaxContext); const context = useContext(WaxContext);
const { const {
options,
pmViews: { main }, pmViews: { main },
} = context; } = context;
const { numericalAnswer } = options;
const NumericalAnswerTool = ComponentPlugin('NumericalAnswer'); const NumericalAnswerTool = ComponentPlugin('NumericalAnswer');
...@@ -82,8 +87,6 @@ export default ({ node, view, getPos }) => { ...@@ -82,8 +87,6 @@ export default ({ node, view, getPos }) => {
}); });
}; };
console.log(context.options.numericalAnswer);
return ( return (
<NumericalAnswerWrapper> <NumericalAnswerWrapper>
<div> <div>
...@@ -103,7 +106,10 @@ export default ({ node, view, getPos }) => { ...@@ -103,7 +106,10 @@ export default ({ node, view, getPos }) => {
<NumericalAnswerContainer className="numerical-answer"> <NumericalAnswerContainer className="numerical-answer">
<EditorComponent getPos={getPos} node={node} view={view} /> <EditorComponent getPos={getPos} node={node} view={view} />
<NumericalAnswerOption> <NumericalAnswerOption>
{!context.options?.numericalAnswer && <>No Type Selected</>} {!numericalAnswer && <>No Type Selected</>}
{numericalAnswer === 'exactAnswer' && <ExactAnswerComponent />}
{numericalAnswer === 'rangeAnswer' && <RangeAnswerComponent />}
{numericalAnswer === 'preciseAnswer' && <PreciseAnswerComponent />}
</NumericalAnswerOption> </NumericalAnswerOption>
{!testMode && !(readOnly && feedback === '') && ( {!testMode && !(readOnly && feedback === '') && (
<FeedbackComponent <FeedbackComponent
......
...@@ -8,12 +8,7 @@ import React, { ...@@ -8,12 +8,7 @@ import React, {
createRef, createRef,
} from 'react'; } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { import { WaxContext, Icon, useOnClickOutside } from 'wax-prosemirror-core';
WaxContext,
DocumentHelpers,
Icon,
useOnClickOutside,
} from 'wax-prosemirror-core';
const Wrapper = styled.div` const Wrapper = styled.div`
opacity: ${props => (props.disabled ? '0.4' : '1')}; opacity: ${props => (props.disabled ? '0.4' : '1')};
...@@ -90,10 +85,8 @@ const NumericalAnswerDropDownCompontent = ({ view = {}, item }) => { ...@@ -90,10 +85,8 @@ const NumericalAnswerDropDownCompontent = ({ view = {}, item }) => {
const context = useContext(WaxContext); const context = useContext(WaxContext);
const { const {
activeView, activeView,
activeViewId,
pmViews: { main }, pmViews: { main },
} = context; } = context;
const { state } = view;
const itemRefs = useRef([]); const itemRefs = useRef([]);
const wrapperRef = useRef(); const wrapperRef = useRef();
......
import React from 'react';
const PreciseAnswerComponent = () => {
return <>Precise Answer Selected</>;
};
export default PreciseAnswerComponent;
import React from 'react';
const RangeAnswerComponent = () => {
return <>Range Answer Selected</>;
};
export default RangeAnswerComponent;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment