PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.6
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.6
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
learnpress / assets / src / apps / js / frontend / quiz / components / buttons / button-hint.js

button-hint.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.6, at assets/src/apps/js/frontend/quiz/components/buttons/button-hint.js

42 lines 836 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Component } from '@wordpress/element';
2 import { withDispatch } from '@wordpress/data';
3 import { compose } from '@wordpress/compose';
4 import { __ } from '@wordpress/i18n';
5
6 class ButtonHint extends Component {
7 /**
8 * Callback to show hint of question
9 */
10 showHint = () => {
11 const { showHint, question } = this.props;
12
13 showHint( question.id, ! question.showHint );
14 };
15
16 render() {
17 const { question } = this.props;
18
19 return (
20 question.hint ? (
21 <button className="btn-show-hint" onClick={ this.showHint }>
22 <span>{ __( 'Hint', 'learnpress' ) }</span>
23 </button>
24 ) : ''
25 );
26 }
27 }
28
29 export default compose(
30 withDispatch( ( dispatch, { id } ) => {
31 const {
32 showHint,
33 } = dispatch( 'learnpress/quiz' );
34
35 return {
36 showHint( id, show ) {
37 showHint( id, show );
38 },
39 };
40 } )
41 )( ButtonHint );
42