diff --git a/src/components/index.ts b/src/components/index.ts index 0f52ffe3..4326b3d3 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -2,5 +2,6 @@ export * from './apply-button' export * from './aura-circle' export * from './floating-button' export * from './glass-card' +export * from './scroll-reveal-container' export * from './section' export * from './seo' diff --git a/src/components/scroll-reveal-container/index.ts b/src/components/scroll-reveal-container/index.ts new file mode 100644 index 00000000..60e8a3b2 --- /dev/null +++ b/src/components/scroll-reveal-container/index.ts @@ -0,0 +1 @@ +export * from './scroll-reveal-container' diff --git a/src/components/scroll-reveal-container/scroll-reveal-container.module.scss b/src/components/scroll-reveal-container/scroll-reveal-container.module.scss new file mode 100644 index 00000000..77b00211 --- /dev/null +++ b/src/components/scroll-reveal-container/scroll-reveal-container.module.scss @@ -0,0 +1,19 @@ +@keyframes animate { + 0% { + opacity: 0; + transform: translate3d(0px, 50px, 0px); + } + 100% { + opacity: 1; + transform: translate3d(0px, 0px, 0px); + } +} + +.box { + opacity: 0; +} + +.visible { + animation: 0.5s ease-in-out 0s 1 normal forwards running animate; + opacity: 1; +} diff --git a/src/components/scroll-reveal-container/scroll-reveal-container.tsx b/src/components/scroll-reveal-container/scroll-reveal-container.tsx new file mode 100644 index 00000000..8fcd5687 --- /dev/null +++ b/src/components/scroll-reveal-container/scroll-reveal-container.tsx @@ -0,0 +1,38 @@ +import clsx from 'clsx' +import { PropsWithChildren, useEffect } from 'react' + +import * as css from './scroll-reveal-container.module.scss' + +interface Props extends PropsWithChildren { + className?: string +} + +export const ScrollRevealContainer = ({ className = '', children }: Props) => { + useEffect(() => { + const initObserver = () => { + const options = { + root: null, + threshold: 0.2, + } + + const observerCallback: IntersectionObserverCallback = (entries) => { + entries.forEach((entry) => { + if (entry.isIntersecting) { + entry.target.classList.add(css.visible) + } + }) + } + + return new IntersectionObserver(observerCallback, options) + } + + const myElements = document.querySelectorAll('.animateBox') + const observer = initObserver() + + myElements.forEach((element) => { + observer.observe(element) + }) + }, [children]) + + return
{children}
+} diff --git a/src/views/about/about.tsx b/src/views/about/about.tsx index fc9b365a..ab16bda5 100644 --- a/src/views/about/about.tsx +++ b/src/views/about/about.tsx @@ -1,6 +1,6 @@ import type { HeadProps, PageProps } from 'gatsby' -import { Seo } from '@/components' +import { ScrollRevealContainer, Seo } from '@/components' import { Main } from '@/layouts' import * as css from './about.module.scss' @@ -21,13 +21,26 @@ const AboutPage = ({ }: PageProps) => { return (
- - - - - + + + + + + + + + + + + + + + - + + + +
) diff --git a/src/views/about/components/product-section/product-section.module.scss b/src/views/about/components/product-section/product-section.module.scss index bccc0e93..628c0c09 100644 --- a/src/views/about/components/product-section/product-section.module.scss +++ b/src/views/about/components/product-section/product-section.module.scss @@ -46,6 +46,13 @@ } } +.center { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + .moreButton { position: absolute; color: #b36afb; diff --git a/src/views/about/components/product-section/product-section.tsx b/src/views/about/components/product-section/product-section.tsx index a8bed7d8..fa65e93e 100644 --- a/src/views/about/components/product-section/product-section.tsx +++ b/src/views/about/components/product-section/product-section.tsx @@ -1,7 +1,7 @@ import { Link } from 'gatsby' import { GatsbyImage, IGatsbyImageData } from 'gatsby-plugin-image' -import { Section } from '@/components' +import { ScrollRevealContainer, Section } from '@/components' import { getRefinedImage } from '@/utils' import * as css from './product-section.module.scss' @@ -38,7 +38,9 @@ export const ProductSection = ({ apps }: Props) => { return (
- + + +
{renderImages(firstSlideItems)}
{renderImages(secondSlideItems)}
diff --git a/src/views/faq/faq.tsx b/src/views/faq/faq.tsx index dede212c..3bc65454 100644 --- a/src/views/faq/faq.tsx +++ b/src/views/faq/faq.tsx @@ -3,7 +3,7 @@ import { HeadProps } from 'gatsby' import { StaticImage } from 'gatsby-plugin-image' import { useState } from 'react' -import { Section, Seo } from '@/components' +import { ScrollRevealContainer, Section, Seo } from '@/components' import { Main } from '@/layouts' import { Cards, Tab } from './constants' @@ -28,53 +28,55 @@ const FaqPage = () => { return (
-
- - + +
+ + -
    - {Cards[currentTab].qnas.map((qna) => ( -
  • -

    {qna.question}

    -
    -

    {qna.answer}

    -
  • - ))} -
+
    + {Cards[currentTab].qnas.map((qna) => ( +
  • +

    {qna.question}

    +
    +

    {qna.answer}

    +
  • + ))} +
- + -
-
+
+
+
) } diff --git a/src/views/home/home.tsx b/src/views/home/home.tsx index c7193c6e..802a22e7 100644 --- a/src/views/home/home.tsx +++ b/src/views/home/home.tsx @@ -1,7 +1,7 @@ import type { HeadProps } from 'gatsby' import { useRef } from 'react' -import { Seo } from '@/components' +import { ScrollRevealContainer, Seo } from '@/components' import { Main } from '@/layouts' import { CounterSection, IntroSection, ScrollIndicator, SupportsSection } from './components' @@ -22,8 +22,12 @@ const HomePage = () => {
- - + + + + + +
diff --git a/src/views/project/project.tsx b/src/views/project/project.tsx index 266eeb45..8b7570de 100644 --- a/src/views/project/project.tsx +++ b/src/views/project/project.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx' import type { HeadProps, PageProps } from 'gatsby' import { useCallback, useMemo, useState } from 'react' -import { Section, Seo } from '@/components' +import { ScrollRevealContainer, Section, Seo } from '@/components' import { Main } from '@/layouts' import { getRefinedImage } from '@/utils' @@ -25,38 +25,40 @@ const ProjectPage = ({ return (
-
- + +
+ - -
    - {refinedProjects.map(({ id, name, description, year, logo, link, rank }) => ( - - ))} -
-
+
+
) } diff --git a/src/views/recruit/recruit.tsx b/src/views/recruit/recruit.tsx index 7d06b931..207ceebb 100644 --- a/src/views/recruit/recruit.tsx +++ b/src/views/recruit/recruit.tsx @@ -1,6 +1,6 @@ import { HeadProps } from 'gatsby' -import { Section, Seo } from '@/components' +import { ScrollRevealContainer, Section, Seo } from '@/components' import { Main } from '@/layouts' import { AuraEffect, PlanCard } from './components' @@ -10,13 +10,15 @@ import * as css from './recruit.module.scss' const RecruitPage = () => { return (
-
- - - - -
-
+ +
+ + + + +
+
+
) }