Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. class QueryBar extends PureComponent {
  2. render() {
  3. const { placeholder, leftIcon, onSubmit, onChange, width } = this.props;
  4. return (
  5. <form
  6. style={{ width }}
  7. onSubmit={e => {
  8. e.preventDefault();
  9. onSubmit(e.target[0].value);
  10. }}
  11. >
  12. <InputGroup
  13. placeholder={placeholder}
  14. width={width}
  15. leftIcon="search"
  16. rightElement={
  17. <Button
  18. type="submit"
  19. icon={leftIcon}
  20. minimal={true}
  21. intent={Intent.PRIMARY}
  22. />
  23. }
  24. />
  25. </form>
  26. );
  27. }
  28. }
  29.  
  30. QueryBar.propTypes = {
  31. width: PropTypes.number,
  32. placeholder: PropTypes.string,
  33. leftIcon: PropTypes.oneOfType(['string', 'element']),
  34. onSubmit: PropTypes.func
  35. };
  36.  
  37. QueryBar.defaultProps = {
  38. placeholder: 'Search...',
  39. leftIcon: 'arrow-right',
  40. width: 360
  41. };
  42. export default QueryBar;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement