Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Modules for Reactors #26

Open
ynunokawa opened this issue Dec 6, 2016 · 0 comments
Open

CSS Modules for Reactors #26

ynunokawa opened this issue Dec 6, 2016 · 0 comments

Comments

@ynunokawa
Copy link
Owner

Geocoder.js

import style from './Geocoder.css'

...

render () {
    let suggestions = null;

    if (this.state.suggestions.length > 0) {
      const suggestionItems = this.state.suggestions.map(function (s, i) {
        return (
          <MenuItem onClick={this._onClickSuggestion} id={s.magicKey} key={s.magicKey}>{s.text}</MenuItem>
        );
      }.bind(this));
      suggestions = (
        <Dropdown.Menu className="style.DropdownMenu">
          {suggestionItems}
        </Dropdown.Menu>
      );
    } else {
      suggestions = (
        <span></span>
      );
    }

    return (
      <FormGroup>
        <InputGroup onChange={this._onChangeText}>
          <FormControl type="text" placeholder={this.props.placeholder} onKeyPress={this._onKeyPress} />
          <InputGroup.Button>
            <Button onClick={this._onSearch}><Glyphicon glyph="search" /></Button>
          </InputGroup.Button>
        </InputGroup>
        {suggestions}
      </FormGroup>
    );
  }

Geocoder.css

.DropdownMenu {
  display: block;
  top: 85%;
  left: 15px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant