Skip to content

Commit

Permalink
🚸 Display drag'n'drop hint when user click on card (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthaud-proust committed Oct 27, 2024
1 parent 08515ae commit ba09816
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
15 changes: 15 additions & 0 deletions components/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ defineProps<{
number: CardNumber;
color: CardColor;
}>();
const { t } = useI18n();
const dragHintOpen = ref(false);
</script>
<template>
<div
@click="dragHintOpen=true"
@mousedown="dragHintOpen = false"
class="border border-card-border relative overflow-hidden select-none w-9 h-11 md:w-12 md:h-16 bg-card-bg rounded flex-col justify-center items-center gap-1 inline-flex"
:class="[movable && 'hover:shadow-lg cursor-move', highlighted && 'ring-4']"
>
Expand Down Expand Up @@ -53,5 +59,14 @@ defineProps<{
>
<LockClosedIcon class="size-4 md:size-6" />
</div>

<UPopover class="absolute inset-0" v-model:open="dragHintOpen" :ui="{ring: 'ring-0'}">
<div class="-z-10 absolute inset-0"></div>
<template #panel>
<div class="p-2 text-xs">
{{ t("components.card.drag_hint") }}
</div>
</template>
</UPopover>
</div>
</template>
6 changes: 5 additions & 1 deletion lang/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import error from "@/lang/fr/error.json";
import pages from "@/lang/fr/pages.json";
import toast from "@/lang/fr/toast.json";
import rules from "@/lang/fr/rules.json";
import card from "@/lang/fr/components/card.json";

export default defineI18nLocale((_locale) => {
return {
pages,
toast,
error,
rules
rules,
components: {
card
}
};
});
3 changes: 3 additions & 0 deletions lang/fr/components/card.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"drag_hint": "Glissez-déposez la tuile pour la déplacer"
}

0 comments on commit ba09816

Please sign in to comment.