Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DropdownBar extends React.Component {
- constructor(props) {
- super(props);
- }
- render () {
- return (
- <div>
- <div className="top-bar">
- <Row>
- <div style={{marginTop: 15, marginBottom:15}}>
- <Col span={8}><FirstDropdown practice={this.props.practice} /></Col>
- <Col span={8}><SecondDropdown /></Col>
- </div>
- </Row>
- </div>
- </div>
- )
- }
- class FirstDropdown extends React.Component {
- constructor() {
- super();
- this.state = {
- practices: [
- name = 'Jon',
- name = 'potato',
- name = 'stark',
- ],
- practice: 'stark'
- }
- }
- onChangePractice(value) {
- console.log(`selected ${value}`);
- this.setState({
- practice: value
- })
- }
- render () {
- const {practices} = this.state
- return (
- <div>
- <Row>
- <div className="First-dropdown">
- <Col span={8}><div className="dropdown-title">Research: </div></Col>
- <Col span={14}>
- <Select
- showSearch
- style={{ width: '100%' }}
- placeholder="Select a Something"
- optionFilterProp="children"
- onChange={this.onChangePractice.bind(this)}
- onFocus={onFocus}
- onBlur={onBlur}
- onSearch={onSearch}
- filterOption={(input, option) =>
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
- }
- >
- {practices.map(practice => (
- <Option
- value={practice}
- key={practice}
- data-automation={practice.name}
- >{practice}</Option>
- ))}
- </Select>
- </Col>
- </div>
- </Row>
- </div>
- )
- }
- class SecondDropdown extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- modules: [
- name = 'Drogon',
- name = 'Rhaegal',
- name = 'Viserion',
- ]
- }
- }
- componentDidUpdate(prevProps) {
- console.log(this.props.practice)
- if (!equal(this.props.practice, prevProps.practice))
- {
- this.updatePractice();
- }
- }
- render () {
- const {modules} = this.state
- console.log(this.props.practice )
- let practice = this.props.practice;
- if (practice === 'stark') {
- return (
- <div>
- <Row>
- <div className="benchmark-dropdown">
- <Col span={4}><div className="dropdown-title">Module: </div></Col>
- <Col span={16}>
- <Select
- showSearch
- style={{ width: '100%' }}
- placeholder="Select Something"
- optionFilterProp="children"
- onChange={onChange}
- onFocus={onFocus}
- onBlur={onBlur}
- onSearch={onSearch}
- filterOption={(input, option) =>
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
- }
- >
- {modules.map(item => (
- <Option
- value={item}
- key={item}
- >{item}</Option>
- ))}
- </Select>
- </Col>
- </div>
- </Row>
- </div>
- )
- } else {
- return <div> NOOOOO </div>
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement