From f00e204ed8a4b9647b69eb4ed0eb0b2934355e7c Mon Sep 17 00:00:00 2001 From: Colin Lienard Date: Thu, 16 May 2024 23:15:23 +0200 Subject: [PATCH] feat: highlights --- app.vue | 2 +- .../{InsightCard.vue => HighlightCard.vue} | 40 +++- components/Layout.vue | 41 +--- components/Navigation.vue | 25 +++ composables/useLanguages.ts | 4 - composables/useSettings.ts | 8 - pages/{insights.vue => highlights.vue} | 9 +- pages/index.vue | 190 +++++++++++------- server/api/{insights.ts => highlights.ts} | 0 9 files changed, 176 insertions(+), 143 deletions(-) rename components/{InsightCard.vue => HighlightCard.vue} (64%) create mode 100644 components/Navigation.vue delete mode 100644 composables/useLanguages.ts delete mode 100644 composables/useSettings.ts rename pages/{insights.vue => highlights.vue} (85%) rename server/api/{insights.ts => highlights.ts} (100%) diff --git a/app.vue b/app.vue index 814d558..137cec2 100644 --- a/app.vue +++ b/app.vue @@ -4,7 +4,7 @@ GitHundred • Top 100 starred GitHub repositories diff --git a/components/InsightCard.vue b/components/HighlightCard.vue similarity index 64% rename from components/InsightCard.vue rename to components/HighlightCard.vue index 1e83249..c832c06 100644 --- a/components/InsightCard.vue +++ b/components/HighlightCard.vue @@ -10,19 +10,28 @@ const { card, index } = defineProps<{ card: Card; index: number }>(); const flippedCards = useFlippedCards(); const flipped = computed(() => flippedCards.value.includes(card.title)); +const isFlipping = ref(false); + +watch(flipped, (newFlipped) => { + if (!newFlipped) return; + isFlipping.value = true; + setTimeout(() => { + isFlipping.value = false; + }, 1000); +}); const [translateX, translateY, rotate] = (() => { switch (index) { case 0: - return ['-1rem', '1rem', '-4deg']; + return ['1rem', '1rem', '4deg']; case 1: - return ['0rem', '2rem', '2deg']; + return ['0', '1rem', '2deg']; case 2: - return ['0rem', '0rem', '-2deg']; + return ['0', '0', '-2deg']; case 3: return ['1rem', '-2rem', '1deg']; case 4: - return ['2rem', '2rem', '4deg']; + return ['1rem', '0', '-2deg']; case 5: default: return ['1rem', '-2rem', '-6deg']; @@ -32,12 +41,15 @@ const [translateX, translateY, rotate] = (() => {