Button.tsx 1.3 KB

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