<!--
 * 动画2
 * https://www.youtube.com/@OnlineTutorialsYT/playlists
  -->
<script lang="ts">
export default {
  name: 'PAGE9',
};
</script>
<script setup lang="ts">
import { ref } from 'vue';
import TextVue from './element/TextVue.vue';
import WorkingDigitalClock from './element/WorkingDigitalClock .vue';
import SvgLineDrawingAnimation from './element/SvgLineDrawingAnimation.vue';
import FlyingTextAnimationEffects from './element/FlyingTextAnimationEffects.vue';
import TransformationAnimation from './element/TransformationAnimation.vue';
import AgGridStudy from './element/AgGridStudy2.vue';
import AgGridMaster from './element/AgGridMaster.vue';
import AgGridDetailGrids from './element/AgGridDetailGrids.vue';

const listData = [
  {
    title: '测试',
    name: 'text-vue',
  },
  {
    title: 'SVG 数字时钟',
    name: 'working-digital-clock',
  },
  {
    title: 'SVG 画线动画',
    name: 'svg-line-drawing-animation',
  },
  {
    title: '飞行文本动画效果 ',
    name: 'flying-text-animation-effects',
  },
  {
    title: '变形动画',
    name: 'transformation-animation',
  },
  {
    title: 'AG grid',
    name: 'ag-grid-study',
  },
  {
    title: 'AG grid 细节表格',
    name: 'ag-grid-master',
  },
  {
    title: 'Vue Data Grid: Master / Detail - Detail Grids',
    name: 'ag-grid-detail-grids',
  },
];
const isShow = ref(true);
const elementName = ref('ag-grid-detail-grids');
const elementTitle = ref('Vue Data Grid: Master / Detail - Detail Grids');

function onclick(data: any) {
  elementTitle.value = data.title;
  elementName.value = data.name;
  isShow.value = true;
}
function goBack() {
  isShow.value = false;
}
</script>

<template>
  <div>
    <div v-if="isShow" class="main">
      <div class="action">
        <q-btn
          @click="goBack"
          round
          flat
          icon="bi-arrow-left"
          size="12px"
          style="color: #555"
        />
        <span>{{ elementTitle }}</span>
      </div>
      <div class="main-content">
        <text-vue v-if="elementName === 'text-vue'" />
        <working-digital-clock v-if="elementName === 'working-digital-clock'" />
        <svg-line-drawing-animation
          v-if="elementName === 'svg-line-drawing-animation'"
        />
        <flying-text-animation-effects
          v-if="elementName === 'flying-text-animation-effects'"
        />
        <transformation-animation
          v-if="elementName === 'transformation-animation'"
        />
        <ag-grid-study v-if="elementName === 'ag-grid-study'" />
        <ag-grid-master v-if="elementName === 'ag-grid-master'" />
        <ag-grid-detail-grids v-if="elementName === 'ag-grid-detail-grids'" />
      </div>
    </div>
    <div v-else>
      <ul class="list">
        <li
          @click="onclick(item)"
          v-for="(item, index) in listData"
          :key="index"
        >
          <p class="title">
            {{ item.title }}
          </p>
        </li>
      </ul>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.list {
  padding: 20px;
  li {
    list-style: none;
    .title {
      cursor: pointer;
      font-size: 16px;
      color: #555;
      &:hover {
        text-decoration: underline;
      }
    }
  }
}

.main {
  .action {
    height: 40px;
    background-color: #fff;
    line-height: 40px;
    box-sizing: border-box;
  }
  .main-content {
    position: relative;
    height: calc(100vh - 90px);
  }
}
</style>
