<div
  class="sm:absolute sm:inset-0 flex flex-col flex-auto min-w-0 sm:overflow-hidden bg-card dark:bg-transparent"
>
  <!-- Header -->
  <div
    class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-8 px-6 md:px-8 border-b"
  >
    <!-- Loader -->
    <div class="absolute inset-x-0 bottom-0" *ngIf="isLoading">
      <mat-progress-bar [mode]="'indeterminate'"></mat-progress-bar>
    </div>
    <!-- Title -->
    <div class="text-4xl font-extrabold tracking-tight">한줄공지</div>
    <!-- Actions -->

    <div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
      <!-- Search -->

      <button mat-icon-button (click)="__onClickSearch()">
        <mat-icon [svgIcon]="'heroicons_outline:search'"></mat-icon>
      </button>
      <button
        class="ml-4"
        mat-flat-button
        [color]="'primary'"
        (click)="__onClickReditBtn($event, '0')"
      >
        <mat-icon [svgIcon]="'heroicons_outline:plus'"></mat-icon>
        <span class="ml-2 mr-1">등록</span>
      </button>
    </div>
  </div>

  <!-- Search --><!-- Search -->
  <div
    *ngIf="__isSearchOpened"
    class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-4 px-6 md:px-8 border-b"
  >
    <!-- Actions -->
    <div fxLayout="row wrap" class="items-center mt-6 sm:mt-0 sm:ml-0">
      <!-- Search -->
      <!-- Add user button -->
      <button
        mat-flat-button
        [color]="'primary'"
        fxFlex
        (click)="__createProduct()"
      >
        <mat-icon [svgIcon]="'heroicons_outline:search'"></mat-icon>
        <span class="ml-2 mr-1">Search</span>
      </button>
    </div>
    <!-- Card inception -->
    <div class="col-span-2 sm:col-span-1">
      <mat-form-field
        class="fuse-mat-no-subscript w-full"
        [floatLabel]="'always'"
      >
        <input
          matInput
          [matDatepicker]="picker1"
          [placeholder]="'Choose a date'"
        />
        <mat-datepicker-toggle
          matSuffix
          [for]="picker1"
        ></mat-datepicker-toggle>
        <mat-datepicker #picker1></mat-datepicker>
      </mat-form-field>
    </div>
    <!-- Card expiration -->
    <div class="col-span-2 sm:col-span-1">
      <mat-form-field
        class="fuse-mat-no-subscript w-full"
        [floatLabel]="'always'"
      >
        <input
          matInput
          [matDatepicker]="picker2"
          [placeholder]="'Choose a date'"
        />
        <mat-datepicker-toggle
          matSuffix
          [for]="picker2"
        ></mat-datepicker-toggle>
        <mat-datepicker #picker2></mat-datepicker>
      </mat-form-field>
    </div>
  </div>

  <!-- Main -->
  <div class="flex flex-auto overflow-hidden">
    <!-- Products list -->
    <div
      class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
    >
      <ng-container *ngIf="noticeOnelines$ | async as noticeOnelines">
        <ng-container *ngIf="noticeOnelines.length > 0; else noUser">
          <div class="grid">
            <!-- Header -->
            <div
              class="notice-oneline-grid z-10 sticky top-0 grid gap-4 py-4 px-6 md:px-8shadow text-md font-semibold text-secondary bg-gray-50 dark:bg-black dark:bg-opacity-5"
            >
              <div class="hidden lg:block">번호</div>
              <div class="hidden lg:block">사이트</div>
              <div class="hidden lg:block">제목</div>
              <div class="hidden lg:block">
                작성자
                <hr style="margin: 7px 0px" />
                작성일
              </div>
              <div class="hidden lg:block">
                조회
                <hr style="margin: 7px 0px" />
                상태
              </div>
            </div>
            <!-- Rows -->
            <ng-container *ngIf="noticeOnelines$ | async as noticeOnelines">
              <ng-container
                *ngFor="
                  let noticeOneline of noticeOnelines;
                  trackBy: __trackByFn
                "
              >
                <div
                  class="notice-oneline-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
                >
                  <!-- 번호 -->
                  <div class="hidden lg:block">
                    {{ noticeOneline.idx }}
                  </div>
                  <!-- 사이트 -->
                  <div class="hidden lg:block">
                    {{ noticeOneline.site }}
                  </div>
                  <!-- 제목 -->
                  <div
                    class="hidden lg:block"
                    style="cursor: pointer"
                    (click)="__onClickReditBtn($event, noticeOneline.id)"
                  >
                    {{ noticeOneline.title }}
                  </div>
                  <!-- 작성자 || 작성일 -->
                  <div class="hidden lg:block">
                    {{ noticeOneline.writer }}
                    <hr style="margin: 7px 0px" />

                    {{ noticeOneline.writeDate }}
                  </div>
                  <!-- 조회 || 상태 -->
                  <div class="hidden lg:block">
                    {{ noticeOneline.views }}
                    <hr style="margin: 7px 0px" />

                    {{ noticeOneline.state }}
                  </div>

                  <!-- management -->
                </div>
              </ng-container>
            </ng-container>
          </div>

          <mat-paginator
            class="sm:absolute sm:inset-x-0 sm:bottom-0 border-b sm:border-t sm:border-b-0 z-10 bg-gray-50 dark:bg-transparent"
            [ngClass]="{ 'pointer-events-none': isLoading }"
            [length]="pagination?.length"
            [pageIndex]="pagination?.page"
            [pageSize]="pagination?.size"
            [pageSizeOptions]="[5, 10, 25, 100]"
            [showFirstLastButtons]="true"
          ></mat-paginator>
        </ng-container>
      </ng-container>

      <ng-template #noUser>
        <div
          class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
        >
          There are no data!
        </div>
      </ng-template>
    </div>
  </div>
</div>
