Skip to content

Commit

Permalink
fix: Доработал снежинки!
Browse files Browse the repository at this point in the history
  • Loading branch information
wokalek committed Dec 1, 2024
1 parent bdbd461 commit 3c6b86d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
29 changes: 29 additions & 0 deletions nuxt/src/components/Layout/Snowflakes.client.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template>
<div ref="snowFlakesRef" class="snowflakes-container" />
</template>

<script setup lang="ts">
import Snowflakes from 'magic-snowflakes'
const snowFlakesRef = ref<HTMLDivElement>()
onMounted(async () => {
await nextTick()
new Snowflakes({
container: snowFlakesRef.value,
color: '#808080',
minOpacity: 0.2,
minSize: 1,
})
})
</script>

<style scoped lang="sass">
.snowflakes-container
position: fixed
height: 100vh
width: 100vw
pointer-events: none
user-select: none
</style>
16 changes: 2 additions & 14 deletions nuxt/src/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div class="layout flex flex-col flex-grow mx-auto fluid-[width,1000-320] max-w-[100vw]">
<LayoutSnowflakes />
<div class="relative flex flex-col flex-grow mx-auto fluid-[width,1000-320] max-w-[100vw]">
<TheHeader />
<main class="flex flex-col justify-center items-center flex-grow py-32-16 px-64-16">
<slot />
Expand All @@ -8,19 +9,6 @@
</div>
</template>

<script setup lang="ts">
import Snowflakes from 'magic-snowflakes'
onMounted(() => {
new Snowflakes({
container: document.querySelector<HTMLDivElement>('.snowflakes-container') as HTMLDivElement,
color: '#808080',
minOpacity: 0.2,
minSize: 1,
})
})
</script>

<style lang="sass" scoped>
:global(html),
:global(body),
Expand Down

0 comments on commit 3c6b86d

Please sign in to comment.