@instructure/quiz-interactions
Version:
A React UI component Library for quiz interaction types.
93 lines • 2.03 kB
JavaScript
import imageUrl from '../exampleImage.png';
export default {
propValues: {
shape: [{
type: 'square',
coordinates: [{
x: 0.3,
y: 0.3
}, {
x: 0.7,
y: 0.7
}]
}, {
type: 'oval',
coordinates: [{
x: 0.3,
y: 0.3
}, {
x: 0.7,
y: 0.7
}]
}, {
type: 'polygon',
coordinates: [{
x: 0.3,
y: 0.3
}, {
x: 0.7,
y: 0.2
}, {
x: 0.8,
y: 0.4
}, {
x: 0.5,
y: 0.5
}, {
x: 0.7,
y: 0.7
}, {
x: 0.2,
y: 0.6
}, {
x: 0.3,
y: 0.3
}]
}, null],
overrideEditableForRegrading: [false, true]
},
getComponentProps: function getComponentProps(props) {
var overrideEditableForRegrading = props.overrideEditableForRegrading,
shape = props.shape;
var itemBody;
if (shape) {
itemBody = "Hotspot Edit (".concat(shape.type, ")");
if (overrideEditableForRegrading) {
itemBody += ' - overrideEditableForRegrading';
}
}
var interactionData = shape ? {
imageUrl: imageUrl
} : {};
var scoringData = {
value: shape || {}
};
var errors, errorsAreShowing;
if (!shape) {
errors = {
itemBody: ['You must have an item body'],
interactionData: {
imageUrl: ['You must upload a file']
},
scoringData: {
value: {
type: ['You must select a hot spot type'],
coordinates: ['You must draw a hot spot']
}
}
};
errorsAreShowing = true;
}
return {
enableRichContentEditor: false,
itemBody: itemBody,
interactionData: interactionData,
scoringData: scoringData,
errors: errors,
errorsAreShowing: errorsAreShowing,
changeItemState: Function.prototype,
mediaUpload: Function.prototype,
openImportModal: Function.prototype
};
}
};