Skip to content
Draft
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
1 change: 0 additions & 1 deletion app/(events)/events/[...filename]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getSEOProps } from "@/lib/seo";
import { EVENTS_MAX_SIZE_OVERRIDE } from "@/services/server/getEvents";
import { fetchTinaData, FileType } from "@/services/tina/fetchTinaData";
import client from "@/tina/client";
import "aos/dist/aos.css"; // This is important to keep the animation
import { Metadata } from "next";
import { cache } from "react";
import EventsPage from "./events";
Expand Down
1 change: 0 additions & 1 deletion app/consulting/[filename]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { TinaClient } from "@/app/tina-client";
import { getSEOProps } from "@/lib/seo";
import { fetchTinaData, FileType } from "@/services/tina/fetchTinaData";
import client from "@/tina/client";
import "aos/dist/aos.css"; // This is important to keep the animation
import { Metadata } from "next";
import { cache } from "react";

Expand Down
1 change: 0 additions & 1 deletion app/consulting/video-production/[filename]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ClientFallback from "@/components/client-fallback";
import { getSEOProps } from "@/lib/seo";
import { fetchTinaData } from "@/services/tina/fetchTinaData";
import client from "@/tina/client";
import "aos/dist/aos.css"; // This is important to keep the animation
import { Metadata } from "next";
import VideoProduction from "./video-production";

Expand Down
19 changes: 0 additions & 19 deletions app/tina-client.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use client";

import AOS from "aos";
import { useEffect } from "react";
import { useTina } from "tinacms/dist/react";
export type UseTinaProps = {
query: string;
Expand All @@ -21,22 +19,5 @@ export function TinaClient<T>({ props, Component }: TinaClientProps<T>) {
data: props.data,
});

useEffect(() => {
if (typeof window !== "undefined") {
AOS.init({
duration: 1200,
once: true,
});

AOS.refresh();
}

return () => {
if (typeof window !== "undefined") {
AOS.refreshHard();
}
};
}, []);

return <Component tinaProps={{ data }} props={{ ...props }} />;
}
1 change: 0 additions & 1 deletion components/blocks/imageComponents/ImageComponentLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client";
import { Container } from "@/components/util/container";
import { VideoModal } from "@/components/videoModal";
import "aos/dist/aos.css";
import Image from "next/image";
import { cn } from "@/lib/utils";
import { tinaField } from "tinacms/dist/react";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
AccordionTrigger,
} from "@/components/ui/accordion";
import { cn } from "@/lib/utils";
import "aos/dist/aos.css";
import classNames from "classnames";
import { tinaField } from "tinacms/dist/react";
import { TinaMarkdown } from "tinacms/dist/rich-text";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import AlternatingText from "@/components/alternating-text";
import ButtonRow from "@/components/blocksSubtemplates/buttonRow";
import { cn } from "@/lib/utils";
import "aos/dist/aos.css";
import classNames from "classnames";
import React from "react";
import { tinaField } from "tinacms/dist/react";
Expand Down
2 changes: 2 additions & 0 deletions components/blocks/testimonialsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dynamic from "next/dynamic";
import { useState } from "react";
import { TestimonialType } from "../../helpers/getTestimonials";
import { CustomLink } from "../customLink";
import AosLoader from "../util/aosLoader";

const Image = dynamic(() => import("next/image"));

Expand All @@ -23,6 +24,7 @@ export const TestimonialCard = ({ testimonial }: TestimonialCardProps) => {
data-aos="flip-right"
key={testimonial?.name}
>
<AosLoader />
<div className="flex flex-col items-center">
<Image
alt={`Avatar of ${testimonial?.name}`}
Expand Down
2 changes: 2 additions & 0 deletions components/blocks/youtubePlaylist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { BsArrowRightCircle } from "react-icons/bs";
import { tinaField } from "tinacms/dist/react";
import { VideoLink } from "../../services/server/youtube";
import { CustomLink } from "../customLink";
import AosLoader from "../util/aosLoader";
import { VideoCard } from "../util/videoCards";

export type YoutubePlaylistProps = {
Expand Down Expand Up @@ -71,6 +72,7 @@ export const YoutubePlaylistBlock: React.FC<YoutubePlaylistProps> = (props) => {
data-aos={playlistButton.animated ? "fade-up" : undefined}
data-tina-field={tinaField(props.playlistButton, "text")}
>
{playlistButton.animated && <AosLoader />}
{playlistButton.text}
<BsArrowRightCircle className="ml-1 inline" />
</CustomLink>
Expand Down
2 changes: 2 additions & 0 deletions components/button/utilityButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { JSX } from "react";
import { BsArrowLeftCircle, BsArrowRightCircle } from "react-icons/bs";
import type { Template } from "tinacms";
import { CustomLink } from "../customLink";
import AosLoader from "../util/aosLoader";
import Button from "./rippleButton";

const sizes = {
Expand Down Expand Up @@ -64,6 +65,7 @@ export const UtilityButton = ({
onClick={() => !disabled && onClick()}
data-aos={animated ? "fade-up" : undefined}
>
{animated && <AosLoader />}
{buttonText}
{btnIcon && iconMapper(btnIcon)}
</Button>
Expand Down
2 changes: 2 additions & 0 deletions components/consulting/mediaCard/mediaCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import classNames from "classnames";
import { FC } from "react";
import { TinaMarkdown, TinaMarkdownContent } from "tinacms/dist/rich-text";
import AosLoader from "../../util/aosLoader";

export type MediaCardProps = {
type: "video" | "blog";
Expand All @@ -22,6 +23,7 @@ const MediaCard: FC<MediaCardProps> = ({ type, content }) => {
bgImagesClasses[type]
)}
>
<AosLoader />
<TinaMarkdown content={content} />
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions components/liveStream/liveStreamWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import layoutData, {
import { LiveStreamProps } from "../../hooks/useLiveStreamProps";
import { VideoEmbed } from "../blocks/videoEmbed";
import { CustomLink } from "../customLink";
import AosLoader from "../util/aosLoader";
import { InlineJotForm } from "../inlineJotForm/inlineJotForm";
import { SocialIcons } from "../socialIcons/socialIcons";

Expand Down Expand Up @@ -147,6 +148,7 @@ export const LiveStreamWidget = ({ isLive, event }: LiveStreamWidgetProps) => {
data-aos-anchor="#thumbnailAnchor"
data-aos-anchor-placement="bottom-top"
>
<AosLoader />
<VideoEmbed
data={{
url: youtubeUrls.videoUrl,
Expand Down
2 changes: 2 additions & 0 deletions components/technologyCard/technologyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FC } from "react";
import { tinaField } from "tinacms/dist/react";
import { TinaMarkdown } from "tinacms/dist/rich-text";
import { CustomLink } from "../customLink";
import AosLoader from "../util/aosLoader";
import { TechnologyCardProps } from "./technologyCardTypes";

const Image = dynamic(() => import("next/image"));
Expand All @@ -14,6 +15,7 @@ const TechnologyCard: FC<TechnologyCardProps> = (props) => {
className="mx-3.5 mb-15 mt-5 flex h-full flex-col border-b-2 border-solid border-sswRed bg-gray-75 px-8 py-11"
data-aos="flip-left"
>
<AosLoader />
{thumbnail ? (
<figure
className="relative h-24 px-8"
Expand Down
2 changes: 2 additions & 0 deletions components/training/presenterBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { tinaField } from "tinacms/dist/react";
import { TinaMarkdown } from "tinacms/dist/rich-text";
import { presenterSchemaConstants } from "../../tina/collections/presenter"; // TODO: Use alias - https://github.com/tinacms/tinacms/issues/4488
import { CustomLink } from "../customLink";
import AosLoader from "../util/aosLoader";
import { Container } from "../util/container";

export const PresenterBlock = ({ data }) => {
return (
<Container size="custom">
<AosLoader />
<h2
className="mb-12 text-center"
data-tina-field={tinaField(data, presenterBlockConstant.header)}
Expand Down
32 changes: 32 additions & 0 deletions components/util/aosLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use client";

import "aos/dist/aos.css";
import { useEffect } from "react";

// Loads and initialises AOS only where a component actually renders data-aos
// elements, instead of on every page. Renders nothing.
let initialised = false;

export const AosLoader = () => {
useEffect(() => {
let cancelled = false;

void import("aos").then((mod) => {
if (cancelled) return;
const AOS = mod.default;
if (!initialised) {
AOS.init({ duration: 1200, once: true });
initialised = true;
}
AOS.refresh();
});

return () => {
cancelled = true;
};
}, []);

return null;
};

export default AosLoader;
2 changes: 2 additions & 0 deletions components/util/consulting/benefits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import dynamic from "next/dynamic";
import { tinaField } from "tinacms/dist/react";
import { TinaMarkdown } from "tinacms/dist/rich-text";
import { CustomLink } from "../../customLink";
import AosLoader from "../aosLoader";

const Image = dynamic(() => import("next/image"));

Expand Down Expand Up @@ -68,6 +69,7 @@ export const Benefits = ({ data }) => {

return (
<article>
<AosLoader />
<section className="grid sm:grid-cols-1 md:grid-cols-2">
{benefitList?.map((benefit, index) => {
return (
Expand Down
2 changes: 2 additions & 0 deletions components/util/videoCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Image from "next/image";
import { FC } from "react";
import Button from "../button/rippleButton";
import { VideoModal } from "../videoModal";
import AosLoader from "./aosLoader";
import { Container } from "./container";
import { Section } from "./section";

Expand Down Expand Up @@ -110,6 +111,7 @@ const VideoCards = ({
window.open(channelLink || defaultChannelLink, "_blank")
}
>
<AosLoader />
<span className="px-7">Watch More Videos</span>
</Button>
</div>
Expand Down
Loading