Button.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. cursor: ${(props: { disabled?: boolean }) =>
  37. props.disabled ? "not-allowed" : "pointer"};
  38. background: ${(props: { disabled?: boolean }) =>
  39. props.disabled ? "#aaaabbee" : "#616FEEcc"};
  40. :hover {
  41. background: ${(props: { disabled?: boolean }) =>
  42. props.disabled ? "" : "#505edddd"};
  43. }
  44. > i {
  45. color: white;
  46. width: 18px;
  47. height: 18px;
  48. font-weight: 600;
  49. font-size: 12px;
  50. border-radius: 20px;
  51. display: flex;
  52. align-items: center;
  53. margin-right: 5px;
  54. justify-content: center;
  55. }
  56. `;