Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

5.4 KB
Raw Blame
@function hexToRGBString($hexColor) {
  @return "rgb(#{red($hexColor)},#{green($hexColor)},#{blue($hexColor)})";
}

$tree-folder-icon: '<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>';
$tree-layers-icon: '<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/>';
$tree-shares-icon: '<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" x2="15.42" y1="13.51" y2="17.49"/><line x1="15.41" x2="8.59" y1="6.51" y2="10.49"/>';
$tree-caret-icon: '<path d="m9 18 6-6-6-6"/>';
$tree-file-icon: '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/>';

@mixin lucide-content($color, $icon, $filled: false, $view-box: '0 0 24 24', $stroke-width: 2.25) {
  $fill: 'none';

  @if $filled {
    $fill: hexToRGBString($color);
  }

  content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="#{$view-box}" fill="#{$fill}" stroke="#{hexToRGBString($color)}" stroke-width="#{$stroke-width}" stroke-linecap="round" stroke-linejoin="round">#{$icon}</svg>');
}

@mixin directory($color) {
  @include lucide-content($color, $tree-folder-icon, $filled: true, $stroke-width: 2);
  display: inline-block;
  width: 25px;
}

@mixin caret($color) {
  @include lucide-content($color, $tree-caret-icon, $view-box: '7 4 10 16');
  display: inline-block;
  width: 7px;
  position: absolute;
  left: 5px;
  top: 7px;
}

@mixin tree-root-icon($color, $path) {
  @include lucide-content($color, $path);
  width: 16px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

@mixin tree-root($color, $path) {
  .toggle-children-wrapper .toggle-children {
    width: 26px;
    height: 26px;
    border-radius: 0.25rem;
    background-color: $color;

    &:before {
      @include tree-root-icon($gray, $path);
    }

    &:after {
      content: none;
    }
  }

  &.active .toggle-children-wrapper .toggle-children:before,
  .toggle-children-wrapper-expanded .toggle-children:before {
    @include tree-root-icon(white, $path);
  }
}

@mixin file($color) {
  @include lucide-content($color, $tree-file-icon, $view-box: '2 2 20 20');
  display: inline-block;
  width: 23px;
}

.copy-move-location-icon {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  height: 1.5rem;

  .lucide {
    font-size: $font-size-md;
  }
}

.copy-move-location-label {
  display: flex;
  align-items: center;
  min-height: 1.5rem;
}

.angular-tree-component {
  display: grid !important;
  white-space: nowrap;
  margin-bottom: 15px;
  font-size: 0.75rem;

  .tree-node {
    position: relative;
  }

  .node-wrapper {
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 4px;
    height: 36px;
    line-height: 0;
    width: 100%;

    &:hover,
    &:focus,
    &:active {
      cursor: default;
      box-shadow: none;
    }

    &.tree-disabled {
      opacity: 0.6;
    }

  }

  .node-content-wrapper {
    display: flex;
    white-space: nowrap;
    margin-left: 0.3rem;
    margin-right: 30px;
    box-shadow: none;
    transition: none;
    background-color: transparent;

    &:hover,
    &:focus,
    &:active {
      cursor: default;
      box-shadow: none;
    }

    tree-node-content {
      display: flex;
      justify-content: center;
      position: relative;

      span {
        @include no-select-utility;
      }
    }
  }

  .toggle-children {
    background-image: none;
  }

  .toggle-children-wrapper {
    padding-left: 10px;
  }

  // folder with no children
  .toggle-children-placeholder {
    padding-left: 10px;

    &:before {
      @include directory($primary);
    }
  }

  .toggle-children-wrapper-expanded .toggle-children {
    transform: none;
    position: relative;
    display: inline-block;

    &:before {
      @include caret(white);
    }

    &:after {
      @include directory($primary);
    }
  }

  .toggle-children-wrapper-collapsed .toggle-children {
    position: relative;
    display: inline-block;
    transform: none;

    &:before {
      @include caret($gray);
    }

    &:after {
      @include directory($primary);
    }
  }

  tree-node-expander.active .toggle-children-wrapper-collapsed .toggle-children:before {
    @include caret(white);
  }

  .tree-root-personal {
    @include tree-root($primary, $tree-folder-icon);
  }

  .tree-root-spaces {
    @include tree-root($primary, $tree-layers-icon);
  }

  .tree-root-shares {
    @include tree-root($purple, $tree-shares-icon);
  }

  .toggle-children-shared {
    .toggle-children-placeholder {
      &:before {
        @include directory($purple);
      }
    }

    .toggle-children {
      &:after {
        @include directory($purple);
      }
    }
  }

  .toggle-children-file {
    .toggle-children-placeholder {
      &:before {
        @include file($primary);
      }
    }
  }

  .node-drop-slot {
    cursor: default;
    height: 0;
  }

  .tree-node-loading {
    color: white;
    position: absolute;
    top: 11px;
    left: 12px;
    margin: 0;
    line-height: 0;
    pointer-events: none;

    .lucide {
      font-size: $font-size-md;
    }
  }
}