Skip to content

Commit 03141ee

Browse files
committed
Добавлена зависимость новогоднего настроения от текущего месяца
1 parent 04d12e6 commit 03141ee

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/components/astro/StripedText.astro

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ export interface Props {
44
}
55
66
const { class: className } = Astro.props;
7+
8+
const currentDate = new Date();
9+
10+
const isNewYear =
11+
currentDate.getMonth() === 11 || currentDate.getMonth() === 0;
712
---
813

914
<span class={className}><slot /></span>
1015

11-
<style>
16+
{isNewYear && <style>
1217
span {
1318
background: repeating-linear-gradient(
1419
var(--stripe__angle, 135deg),
@@ -24,4 +29,4 @@ const { class: className } = Astro.props;
2429
-webkit-background-clip: text;
2530
-webkit-text-fill-color: transparent;
2631
}
27-
</style>
32+
</style>}

src/layouts/BasePage.astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import SnowFall from "@components/astro/SnowFall.astro";
77
export type Props = HeadProps;
88
99
const { title, description, image, type } = Astro.props;
10+
11+
const currentDate = new Date();
12+
13+
const hasSnow = currentDate.getMonth() >= 10 || currentDate.getMonth() <= 2;
1014
---
1115

1216
<html lang="ru">
@@ -31,7 +35,7 @@ const { title, description, image, type } = Astro.props;
3135
<body>
3236
<WebComponentsDefinitions />
3337

34-
<SnowFall />
38+
{hasSnow && <SnowFall />}
3539

3640
<slot />
3741

0 commit comments

Comments
 (0)