MobileRightAside.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <script setup lang="ts">
  2. import { onMounted, useTemplateRef } from 'vue'
  3. import { ButtonAnimationProvider } from '@/components'
  4. import { useInjection } from '@/composables'
  5. import { layoutInjectionKey } from '@/injection'
  6. import Action from '../header/action/index.vue'
  7. const { layoutSlideDirection, mobileRightAsideWidth } = useInjection(layoutInjectionKey)
  8. const mobileRightAsideRef = useTemplateRef<HTMLElement>('mobileRightAside')
  9. onMounted(() => {
  10. if (mobileRightAsideRef.value) {
  11. mobileRightAsideWidth.value = mobileRightAsideRef.value.clientWidth
  12. }
  13. })
  14. </script>
  15. <template>
  16. <div
  17. ref="mobileRightAside"
  18. class="absolute top-0 right-0 h-svh py-4 pr-4 transition-[translate]"
  19. :class="{
  20. 'translate-x-full': layoutSlideDirection !== 'left',
  21. }"
  22. >
  23. <div class="flex h-full items-center justify-between">
  24. <ButtonAnimationProvider
  25. size="large"
  26. :circle="false"
  27. >
  28. <Action class="flex-col justify-center gap-y-4" />
  29. </ButtonAnimationProvider>
  30. </div>
  31. </div>
  32. </template>