Skip to content

Commit

Permalink
Merge pull request #1 from gdorsi/main
Browse files Browse the repository at this point in the history
feat: cinematic cover
  • Loading branch information
gdorsi authored Nov 14, 2023
2 parents c7964b1 + 1e9ccd4 commit be68502
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
28 changes: 28 additions & 0 deletions components/Confetti.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<script setup>
import { ref, onMounted } from "vue";
import ConfettiGenerator from "confetti-js";
// declare a ref to hold the element reference
// the name must match template ref value
const canvas = ref(null);
onMounted(() => {
const confettiSettings = { target: canvas.value };
const confetti = new ConfettiGenerator(confettiSettings);
confetti.render();
});
</script>

<style>
.confetti {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>

<template>
<canvas class="confetti" ref="canvas"></canvas>
</template>
4 changes: 4 additions & 0 deletions components/Logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
--logo-width: 150px;
}
.slidev-vclick-hidden .logo {
display: none;
}
.logo {
margin: auto;
border-radius: 17px;
Expand Down
5 changes: 5 additions & 0 deletions slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ fonts:

La community di appassionati Javascript a Roma

<v-click>

<div class="abs-br m-6 flex gap-2">
<Logo />
</div>
<Confetti />

</v-click>

---

Expand Down
22 changes: 0 additions & 22 deletions theme/layouts/cover.vue
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
<script setup>
import { ref, onMounted } from "vue";
import ConfettiGenerator from "confetti-js";

// declare a ref to hold the element reference
// the name must match template ref value
const canvas = ref(null);

onMounted(() => {
const confettiSettings = { target: canvas.value };
const confetti = new ConfettiGenerator(confettiSettings);
confetti.render();
});
</script>

<style>
.confetti {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>

<template>
<div class="slidev-layout cover text-center">
<div class="my-auto w-full">
<slot />
</div>
<canvas class="confetti" ref="canvas"></canvas>
</div>
</template>

0 comments on commit be68502

Please sign in to comment.