Resource.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <div @mousemove="onMouseMove($event)"
  3. class="group relative flex rounded-2xl transition-shadow hover:shadow-md bg-white/2.5 hover:shadow-black/5">
  4. <Pattern
  5. :mouse-x="mouseX"
  6. :mouse-y="mouseY"
  7. :pattern="resource.pattern"/>
  8. <div class="absolute inset-0 rounded-2xl ring-1 ring-inset ring-white/10 group-hover:ring-white/20" ></div>
  9. <div class="relative rounded-2xl px-4 pt-16 pb-4">
  10. <ResourceIcon :icon="resource.icon"/>
  11. <h3 class="mt-4 text-sm font-semibold leading-7 text-white">
  12. <NuxtLink :to="resource.href">
  13. <span class="absolute inset-0 rounded-2xl" />
  14. {{ resource.name }}
  15. </NuxtLink>
  16. </h3>
  17. <p class="mt-1 text-sm text-zinc-400">
  18. {{ resource.description }}
  19. </p>
  20. </div>
  21. </div>
  22. </template>
  23. <script setup>
  24. const props = defineProps(['resource']);
  25. const mouseX = ref(0);
  26. const mouseY = ref(0);
  27. const onMouseMove = ( event ) => {
  28. let { left, top } = event.target.getBoundingClientRect();
  29. mouseX.value = event.clientX - left;
  30. mouseY.value = event.clientY - top;
  31. }
  32. </script>