Skip to content

Instantly share code, notes, and snippets.

@EdwinGuzman
Created November 30, 2017 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdwinGuzman/d7466458187b74c39110a2285f30de94 to your computer and use it in GitHub Desktop.
Save EdwinGuzman/d7466458187b74c39110a2285f30de94 to your computer and use it in GitHub Desktop.
// Search.jsx
class Search extends React.Component {
// Other class functions...
render() {
// Here we can pass the class that we want this “omni-search” component to have as a React prop.
const style = this.props.style;
return (
<form onKeyPress={this.triggerSubmit} method="POST">
<div className={`nypl-omnisearch ${style} nypl-spinner-field`}>
<!-- more elements here ->
</form>
);
}
}
// Component that renders Search
class Homepage extends React.Component {
// Other class functions
render() {
return (
<div id="main-content">
<Search style="homepage-style" />
<!-- other components and elements -->
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment