src/components/FontSizeDropdown/FontSizeDropdown.scss
@import '../../constants/styles';

.FontSizeDropdown {
  position: relative;
  width: 100%;
  display: flex;
  background: var(--component-background);
  border: 1px solid var(--border);
  border-radius: 4px;
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
  height: 28px;
  padding: 3px 4px;

  &.disabled {
    border: 1px solid var(--gray-4);
  }

  @include mobile {
    height: 32px;
  }

  input {
    width: 25px;
    border: 0;
    height: 100%;
    flex: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    &:focus {
      border: 1px solid var(--blue-5);
    }

    &.error {
      border-color: var(--error-border-color);
    }

    @include mobile {
      font-size: 13px;
    }
  }

  .disabledText {
    color: var(--disabled-text);
  }

  // To remove arrows from input
  /* Chrome, Safari, Edge, Opera */
  input::-webkit-outer-spin-button,
  input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  /* Firefox */
  input[type='number'] {
    -moz-appearance: textfield;
  }

  .icon-button {
    flex: inherit;
    height: 16px;
    width: 16px;

    @include mobile {
      margin-inline-end: 4px;
    }

    .Icon {
      height: 100%;
      width: 100%;
    }
  }

  .hidden {
    display: none !important;
  }

  .Dropdown__items {
    z-index: 1; // Needed to not trigger mouse events underneath the dropdown
    display: flex;
    flex-direction: column;
    position: absolute;
    inset-block-start: 30px;
    inset-inline-end: 0px;
    border-radius: 4px;
    box-shadow: 0px 0px 3px 0px var(--document-box-shadow);

    background: var(--component-background);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow-x: hidden; // necessary so that children respect border-radius on hover
    overflow-y: auto;
    max-height: 200px;

    &.hide {
      // Required to get width for positioning.
      visibility: hidden;
    }

    .Dropdown__item {
      @include button-reset;
      height: 28px;
      padding-inline-start: 8px;
      align-items: center;
      display: flex;
      border-radius: 0px;
      padding-inline-end: 32px;
      font-size: var(--font-size-default);
      line-height: 28px;

      &.active,
      &:hover {
        color: var(--dropdown-item-active-text);

        .Icon,
        .Icon svg * {
          color: var(--dropdown-item-active-icon);
        }
      }

      &.active {
        background-color: var(--dropdown-item-active);
      }

      &:hover {
        background-color: var(--dropdown-item-hover);
      }

      &:first-child {
        border-top-right-radius: 4px;
        border-top-left-radius: 4px;
      }

      &:last-child {
        border-bottom-right-radius: 4px;
        border-bottom-right-radius: 4px;
      }
    }
  }
}
