mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
add ui
This commit is contained in:
1 parent
777a4bc927
commit
9c45527522
396 files changed
+13772
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import i18n from 'vj/utils/i18n';
|
||||
import DataInput from './DataInputComponent';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
data: state.pretest.data,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
handleDataChange(id, type, value) {
|
||||
dispatch({
|
||||
type: 'SCRATCHPAD_PRETEST_DATA_CHANGE',
|
||||
payload: {
|
||||
id,
|
||||
type,
|
||||
value,
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const mergeProps = (stateProps, dispatchProps, ownProps) => ({
|
||||
...dispatchProps,
|
||||
id: ownProps.id,
|
||||
input: stateProps.data[ownProps.id] ? stateProps.data[ownProps.id].input : '',
|
||||
output: stateProps.data[ownProps.id] ? stateProps.data[ownProps.id].output : '',
|
||||
});
|
||||
|
||||
@connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
||||
export default class ScratchpadPretestTabPaneContainer extends React.PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<div className="flex-row flex-fill">
|
||||
<DataInput
|
||||
title={i18n('Sample Input')}
|
||||
value={this.props.input}
|
||||
onChange={v => this.props.handleDataChange(this.props.id, 'input', v)}
|
||||
/>
|
||||
<DataInput
|
||||
title={i18n('Sample Output')}
|
||||
value={this.props.output}
|
||||
onChange={v => this.props.handleDataChange(this.props.id, 'output', v)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user