Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add santa #1561

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions img/ImageComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import CheckboxPng from "./png/check-box-1.png";
import KalenderPng from "./png/kalender.png";
import KalenderHoverPng from "./png/kalender--hover.png";
import PilForrigeBlaaPng from "./png/pilForrige--blaa.png";
import SantaTransparent from "./png/santa_transparent.png";

// GIF
import EasterRoll from "./gif/easter_roll.gif";
Expand Down Expand Up @@ -141,4 +142,5 @@ export {
PilForrigeBlaaPng,
UtropstegnImage,
SaveFile,
SantaTransparent,
};
Binary file added img/png/santa_transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions src/components/Santa.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";
import { SantaTransparent } from "../../img/ImageComponents";

export const Santa = () => {
const [animation, setAnimation] = React.useState("none");

const setRandomAnimationType = () => {
const animationTypes = ["spin", "ping", "pulse", "bounce"].filter(
(type) => type !== animation
);
setAnimation(
animationTypes[Math.floor(Math.random() * animationTypes.length)]
);
console.log("AMI: ", animation);
};

return (
<div
className="flex flex-row items-center"
onClick={setRandomAnimationType}
>
<img
className={`pl-2 w-10 animate-[${animation}_1s_ease-in-out]`}
src={SantaTransparent}
alt={"nisse"}
/>
</div>
);
};
4 changes: 3 additions & 1 deletion src/sider/Side.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
GlobalNavigasjon,
Menypunkter,
} from "@/components/globalnavigasjon/GlobalNavigasjon";
import { isEaster, isPride } from "@/utils/festiveUtils";
import { isDecember, isEaster, isPride } from "@/utils/festiveUtils";
import { Easter } from "@/components/festive/Easter";
import * as Amplitude from "@/utils/amplitude";
import { EventType } from "@/utils/amplitude";
Expand All @@ -14,6 +14,7 @@ import { Pride } from "@/components/festive/Pride";
import { Oppfolgingsoppgave } from "@/components/oppfolgingsoppgave/Oppfolgingsoppgave";
import { useDiskresjonskodeQuery } from "@/data/diskresjonskode/diskresjonskodeQueryHooks";
import { TildeltVeileder } from "@/components/TildeltVeileder";
import { Santa } from "@/components/Santa";

export const MODIA_HEADER_ID = "modia-header";

Expand Down Expand Up @@ -48,6 +49,7 @@ export default function Side({
<div className="flex flex-col" id={MODIA_HEADER_ID}>
<div className="flex flex-row mt-4 mb-2 w-full">
<OversiktLenker />
{isDecember() && <Santa />}
<TildeltVeileder />
</div>
{isPride() && <Pride>&nbsp;</Pride>}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/festiveUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum Month {
DECEMBER = 11,
}

const isDecember = () => {
export const isDecember = () => {
const currentMonth = new Date().getMonth();

return currentMonth === Month.DECEMBER;
Expand Down
Loading