| 1 |
import { default as ButtonHint } from '../buttons/button-hint'; |
| 2 |
import { default as ButtonCheck } from '../buttons/button-check'; |
| 3 |
import { MaybeShowButton } from '../buttons'; |
| 4 |
import { Fragment } from '@wordpress/element'; |
| 5 |
|
| 6 |
const Buttons = function Buttons( props ) { |
| 7 |
const { |
| 8 |
question, |
| 9 |
} = props; |
| 10 |
|
| 11 |
const buttons = { |
| 12 |
'instant-check': () => { |
| 13 |
return ( |
| 14 |
<MaybeShowButton |
| 15 |
type="check" |
| 16 |
Button={ ButtonCheck } |
| 17 |
question={ question } |
| 18 |
/> |
| 19 |
); |
| 20 |
}, |
| 21 |
hint: () => { |
| 22 |
return ( |
| 23 |
<MaybeShowButton |
| 24 |
type="hint" |
| 25 |
Button={ ButtonHint } |
| 26 |
question={ question } |
| 27 |
/> |
| 28 |
); |
| 29 |
}, |
| 30 |
}; |
| 31 |
|
| 32 |
return ( |
| 33 |
<> |
| 34 |
{ LP.config.questionFooterButtons().map( ( name ) => { |
| 35 |
return ( |
| 36 |
<Fragment key={ `button-${ name }` }> |
| 37 |
{ buttons[ name ] && buttons[ name ]() } |
| 38 |
</Fragment> |
| 39 |
); |
| 40 |
} ) } |
| 41 |
</> |
| 42 |
); |
| 43 |
}; |
| 44 |
|
| 45 |
export default Buttons; |
| 46 |
|