Button.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. 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. font-family: "Work Sans", sans-serif;
  30. color: white;
  31. font-weight: 500;
  32. padding: 10px;
  33. overflow: hidden;
  34. white-space: nowrap;
  35. text-overflow: ellipsis;
  36. box-shadow: 0 5px 8px 0px #00000010;
  37. cursor: ${(props: { disabled?: boolean }) =>
  38. props.disabled ? "not-allowed" : "pointer"};
  39. background: ${(props: { disabled?: boolean }) =>
  40. props.disabled ? "#aaaabbee" : "#616FEEcc"};
  41. :hover {
  42. background: ${(props: { disabled?: boolean }) =>
  43. props.disabled ? "" : "#505edddd"};
  44. }
  45. > i {
  46. color: white;
  47. width: 18px;
  48. height: 18px;
  49. font-weight: 600;
  50. font-size: 12px;
  51. border-radius: 20px;
  52. display: flex;
  53. align-items: center;
  54. margin-right: 5px;
  55. justify-content: center;
  56. }
  57. `;