Button.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React from "react";
  2. import styled from "styled-components";
  3. type Props = {
  4. disabled?: boolean;
  5. children: React.ReactNode;
  6. onClick: () => void;
  7. className?: string;
  8. };
  9. const Button: React.FC<Props> = ({
  10. children,
  11. disabled,
  12. onClick,
  13. className,
  14. }) => {
  15. return (
  16. <ButtonWrapper className={className} disabled={disabled} onClick={onClick}>
  17. {children}
  18. </ButtonWrapper>
  19. );
  20. };
  21. export default Button;
  22. const ButtonWrapper = styled.div`
  23. display: flex;
  24. flex-direction: row;
  25. align-items: center;
  26. justify-content: space-between;
  27. font-size: 13px;
  28. cursor: pointer;
  29. color: white;
  30. font-weight: 500;
  31. padding: 10px;
  32. overflow: hidden;
  33. white-space: nowrap;
  34. text-overflow: ellipsis;
  35. cursor: ${(props: { disabled?: boolean }) =>
  36. props.disabled ? "not-allowed" : "pointer"};
  37. background: ${(props: { disabled?: boolean }) =>
  38. props.disabled ? "#aaaabbee" : "#616FEEcc"};
  39. :hover {
  40. background: ${(props: { disabled?: boolean }) =>
  41. props.disabled ? "" : "#505edddd"};
  42. }
  43. > i {
  44. color: white;
  45. width: 18px;
  46. height: 18px;
  47. font-weight: 600;
  48. font-size: 12px;
  49. border-radius: 20px;
  50. display: flex;
  51. align-items: center;
  52. margin-right: 5px;
  53. justify-content: center;
  54. }
  55. `;