<div class="uk-height-1-1" uk-form-custom ...attributes>
  <UkButton
    @color="primary"
    @size="small"
    class="uk-height-1-1"
    tabindex="-1"
    @loading={{this.upload.isRunning}}
    data-test-upload
  >
    {{t "alexandria.upload-file"}}
  </UkButton>

  {{#if @categoryId}}
    <input
      type="file"
      multiple="multiple"
      data-test-input
      aria-label="Category name"
      accept={{this.category.accept}}
      {{on "change" (fn this.upload.perform @categoryId)}}
    />
  {{else}}
    <Drop @width="uk-with-medium" as |Item|>
      {{#each this.categories.records as |category|}}
        <Item uk-form-custom data-test-upload-category>
          <input
            type="file"
            multiple="multiple"
            data-test-input
            aria-label="file input"
            accept={{category.accept}}
            {{on "change" (fn this.upload.perform category.id)}}
          />
          <FaIcon
            @prefix="far"
            @icon="folder"
            @size="2x"
            class="uk-margin-small-right"
            data-test-folder-icon
            {{set-style color=category.color}}
          />
          {{category.name}}
        </Item>
        {{#if category.children.length}}
          {{#each category.children as |child|}}
            <Item class="item--indent" uk-form-custom data-test-upload-category>
              <input
                type="file"
                multiple="multiple"
                data-test-input
                aria-label="file input"
                accept={{child.accept}}
                {{on "change" (fn this.upload.perform child.id)}}
              />
              <FaIcon
                @prefix="far"
                @icon="folder"
                @size="2x"
                class="uk-margin-small-right"
                data-test-folder-icon
                {{set-style color=child.color}}
              />
              {{child.name}}
            </Item>
          {{/each}}
        {{/if}}
      {{else}}
        <span data-test-no-categories>
          {{t "alexandria.document-upload-button.no-categories"}}
        </span>
      {{/each}}
    </Drop>
  {{/if}}
</div>