import styled from "styled-components";

export const SwitchContainer = styled.div`
  display: flex;
  align-items: center;
`;

export const SwitchLabel = styled.label`
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
`;

export const SwitchSlider = styled.span`
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: ${({ color }) => color};
  -webkit-transition: 0.4s;
  transition: 0.4s;
  border-radius: 34px;

  .icon {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    right: 4px;
    bottom: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #dfe5e5;

    color: transparent;
    -webkit-transition: 0.4s;
    transition: 0.4s;
    border-radius: 50%;
  }
`;

export const SwitchInput = styled.input`
  opacity: 0;
  width: 0;
  height: 0;

  &:not(:checked) + ${SwitchSlider} {
    /* background-color: rgb(198, 204, 204); */

    color: ${({ color }) => color};
    .icon {
      color: ${({ color }) => color};

      background-color: #fff;
    }
  }
  &:checked + ${SwitchSlider} {
    background-color: ${({ color }) => (color ? "rgb(198, 204, 204)" : color)};
  }

  &:focus + ${SwitchSlider} {
    box-shadow: 0 0 1px rgba(198, 204, 204, 0.3);
  }

  &:checked + ${SwitchSlider} .icon {
    transform: translateX(-26px);
  }
`;
