SelectRow.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import React, { Component } from "react";
  2. import styled from "styled-components";
  3. import Selector from "../Selector";
  4. type PropsType = {
  5. label: string;
  6. value: string;
  7. setActiveValue: (x: string) => void;
  8. options: { value: string; label: string }[];
  9. dropdownLabel?: string;
  10. width?: string;
  11. dropdownMaxHeight?: string;
  12. scrollBuffer?: boolean;
  13. doc?: string;
  14. };
  15. type StateType = {};
  16. export default class SelectRow extends Component<PropsType, StateType> {
  17. render() {
  18. return (
  19. <StyledSelectRow>
  20. <Wrapper>
  21. <Label>{this.props.label}</Label>
  22. {this.props.doc ? (
  23. <a href={this.props.doc} target="_blank">
  24. <i className="material-icons">help_outline</i>
  25. </a>
  26. ) : null}
  27. </Wrapper>
  28. <SelectWrapper>
  29. <Selector
  30. scrollBuffer={this.props.scrollBuffer}
  31. activeValue={this.props.value}
  32. setActiveValue={this.props.setActiveValue}
  33. options={this.props.options}
  34. dropdownLabel={this.props.dropdownLabel}
  35. width={this.props.width || "270px"}
  36. dropdownWidth={this.props.width}
  37. dropdownMaxHeight={this.props.dropdownMaxHeight}
  38. />
  39. </SelectWrapper>
  40. </StyledSelectRow>
  41. );
  42. }
  43. }
  44. const SelectWrapper = styled.div``;
  45. const Wrapper = styled.div`
  46. display: flex;
  47. align-items; center;
  48. > a {
  49. > i {
  50. font-size: 18px;
  51. margin-left: 8px;
  52. margin-top: 2px;
  53. color: #8590ff;
  54. :hover {
  55. color: #aaaabb;
  56. }
  57. }
  58. }
  59. `;
  60. const Label = styled.div`
  61. color: #ffffff;
  62. margin-bottom: 10px;
  63. font-size: 13px;
  64. `;
  65. const StyledSelectRow = styled.div`
  66. margin-bottom: 15px;
  67. margin-top: 20px;
  68. `;