You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
React
44 lines
1.1 KiB
React
4 years ago
|
import React from 'react';
|
||
|
|
||
|
export default class MessagePadContainer extends React.PureComponent {
|
||
|
Textbox(args, name) {
|
||
|
return (
|
||
|
<label htmlFor={`textbox${name}`}>
|
||
|
{args.desc}
|
||
|
<div name={`form_item_${name}`} className="textbox-container">
|
||
|
<input type="text" name={name} id={`textbox${name}`} className="textbox"></input>
|
||
|
</div>
|
||
|
</label>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Radio(args, name) {
|
||
|
return (
|
||
|
<>
|
||
|
{args.desc}
|
||
|
{args.choices.map((i) => (
|
||
|
<label className="radiobox" htmlFor={`radio${name}`}>
|
||
|
<input type="radio" name={name} id={`radio${name}`} value={i} /> {i} <br />
|
||
|
</label>
|
||
|
))}
|
||
|
</>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
return (
|
||
|
<form>
|
||
|
{this.props.panel.map((i, name) => (
|
||
|
<div className="row">
|
||
|
<div className="medium-7 columns form__item end">
|
||
|
{i.type === 'textbox' && this.Textbox(i, name)}
|
||
|
{i.type === 'radio' && this.Radio(i, name)}
|
||
|
</div>
|
||
|
</div>
|
||
|
))}
|
||
|
<input type="submit" className="button rounded primary" value="提交" />
|
||
|
</form>
|
||
|
);
|
||
|
}
|
||
|
}
|