Skip to content

Commit

Permalink
refact : component file structure refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
whatisyourname0 committed Jul 29, 2023
1 parent 1c7bd2e commit f4ef356
Show file tree
Hide file tree
Showing 71 changed files with 371 additions and 358 deletions.
6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import TransitionColorProvider from '@context/TransitionColorContext';
import Page404 from '@pages/404';
import { AboutUs } from '@pages/AboutUs';
import ClubsPage from '@pages/Clubs';
import DeveloperPage from '@pages/Developer';
import GooglePage from '@pages/Google';
import { ClubsPage } from '@pages/Clubs';
import { DeveloperPage } from '@pages/Developer';
import GooglePage from '@pages/Google/GooglePage';
import Home from '@pages/Home';
import StudentPage from '@pages/Student';
import { AnimatePresence } from 'framer-motion';
Expand Down
2 changes: 1 addition & 1 deletion src/components/GithubCursor/GithubCursor.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactComponent as GithubIcon } from '@assets/images/icons/github.svg';
import { MouseContext } from '@context/MouseContext';
import useMousePosition from '@hooks/useMousePosition/useMousePosition';
import { useMousePosition } from '@hooks';
import { memo, useContext } from 'react';
import styled, { css } from 'styled-components';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Head/Head.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import useIdle from '@hooks/useIdle/useIdle';
import { useIdle } from '@hooks';
import { Helmet } from 'react-helmet-async';

function Head() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/MainHeader/MainHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DelayedLink } from '@components/DelayedLink';
import { DropdownIcon } from '@components/DropdownIcon';
import { TRANSITION_DURATION } from '@constants/constants';
import { TransitionColorContext } from '@context/TransitionColorContext';
import useComponentVisible from '@hooks/useComponentVisible/useComponentVisible';
import { useComponentVisible } from '@hooks';
import DropdownList from '@pages/Home/Hero/components/DropdownList';
import { useContext } from 'react';
import { useLocomotiveScroll } from 'react-locomotive-scroll';
Expand Down
35 changes: 18 additions & 17 deletions src/hooks/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
export { useCanvas } from './useCanvas';
export { useComponentVisible } from './useComponentVisible';
export { useGoogleAnalytics } from './useGoogleAnalytics';
export { useHandleAnimationScroll } from './useHandleAnimationScroll';
export { useHover } from './useHover';
export { useIdle } from './useIdle';
export { useIntersectionObserver } from './useIntersectionObserver';
export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
export { useKeyPress } from './useKeyPress';
export { useLocomotiveScrollPosition } from './useLocomotiveScrollPosition';
export { useMediaQuery } from './useMediaQuery';
export { useMount } from './useMount';
export { useOnScreen } from './useOnScreen';
export { useScrollPosition } from './useScrollPosition';
export { useTimeout } from './useTimeout';
export { useUnmount } from './useUnmount';
export { useWindowSize } from './useWindowSize';
export * as useCanvas from './useCanvas';
export * as useComponentVisible from './useComponentVisible';
export * as useGoogleAnalytics from './useGoogleAnalytics';
export * as useHandleAnimationScroll from './useHandleAnimationScroll';
export * as useHover from './useHover';
export * as useIdle from './useIdle';
export * as useIntersectionObserver from './useIntersectionObserver';
export * as useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect';
export * as useKeyPress from './useKeyPress';
export * as useLocomotiveScrollPosition from './useLocomotiveScrollPosition';
export * as useMediaQuery from './useMediaQuery';
export * as useMount from './useMount';
export * as useMousePosition from './useMousePosition';
export * as useOnScreen from './useOnScreen';
export * as useScrollPosition from './useScrollPosition';
export * as useTimeout from './useTimeout';
export * as useUnmount from './useUnmount';
export * as useWindowSize from './useWindowSize';
3 changes: 2 additions & 1 deletion src/hooks/useGoogleAnalytics/useGoogleAnalytics.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import useMount from '@hooks/useMount/useMount';
import { useEffect, useState } from 'react';
import ReactGA from 'react-ga4';
import { useLocation } from 'react-router-dom';

import { useMount } from '..';

const useGoogleAnalytics = () => {
const location = useLocation();
const [initialized, setInitialized] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useTimeout/useTimeout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import useIsomorphicLayoutEffect from '@hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';
import { useIsomorphicLayoutEffect } from '@hooks';
import { useEffect, useRef } from 'react';

function useTimeout(cb, delay) {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/AboutUs/AboutUs.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { LoadingScreen } from '@components/LoadingScreen';
import { LocomotiveScrollProvider } from '@context';
import { TransitionColorContext } from '@context/TransitionColorContext';
import useHandleAnimationScroll from '@hooks/useHandleAnimationScroll/useHandlerAnimationScroll';
import useMount from '@hooks/useMount/useMount';
import { useHandleAnimationScroll, useMount } from '@hooks';
import { useContext, useRef } from 'react';
import styled, { useTheme } from 'styled-components';

Expand Down
3 changes: 1 addition & 2 deletions src/pages/AboutUs/Hero/Hero.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import useLocomotiveScrollPosition from '@hooks/useLocomotiveScrollPosition/useLocomotiveScrollPosition';
import useWindowSize from '@hooks/useWindowSize/useWindowSize';
import { useLocomotiveScrollPosition, useWindowSize } from '@hooks';
import styled from 'styled-components';

import { BackgroundVideo, GoBackArrow, SearchBar } from '../components';
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/pages/Clubs/Banner/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Banner } from './Banner';
64 changes: 64 additions & 0 deletions src/pages/Clubs/ClubsPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { LoadingScreen } from '@components/LoadingScreen';
import { LocomotiveScrollProvider } from '@context';
import { TransitionColorContext } from '@context/TransitionColorContext';
import { useHandleAnimationScroll, useMount } from '@hooks';
import { useContext, useRef } from 'react';
import styled, { useTheme } from 'styled-components';

import Banner from './Banner/Banner';
import { GalleryComponent } from './GalleryComponent';

function ClubsPage() {
const { handleAnimationStart, handleAnimationComplete } = useHandleAnimationScroll();
const { transitionColorHandler } = useContext(TransitionColorContext);
const { color } = useTheme();
const containerRef = useRef(null);

useMount(() => {
transitionColorHandler(color.yellow);
});

return (
<>
<LocomotiveScrollProvider.Horizontal containerRef={containerRef}>
<Container data-scroll-container ref={containerRef} id="#fixed-element-clubs-container">
<Banner />
<GalleryPadding data-scroll-section />
<GalleryComponent />
</Container>
</LocomotiveScrollProvider.Horizontal>
<LoadingScreen
handleAnimationStart={handleAnimationStart}
handleAnimationComplete={handleAnimationComplete}
/>
</>
);
}

export default ClubsPage;

const Container = styled.main`
width: fit-content;
height: 100vh;
display: flex;
font-family: 'Google Sans', sans-serif;
perspective: 1px; // for locomotive-scroll element disappearance bug fix.
background-color: ${(props) => props.theme.backgroundColor.white};
${({ theme }) => theme.tablet`
height: calc(var(--vh, 1vh) * 100);
`}
`;

const GalleryPadding = styled.div`
width: 35vw;
height: 100%;
background: linear-gradient(
to right,
${(props) => props.theme.backgroundColor.white} 0%,
${(props) => props.theme.backgroundColor.black} 100%
);
`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'swiper/css';
import 'swiper/css/pagination';

import useKeyPress from '@hooks/useKeyPress/useKeyPress';
import { useKeyPress } from '@hooks';
import { motion } from 'framer-motion';
import { useEffect, useRef } from 'react';
import { useLocomotiveScroll } from 'react-locomotive-scroll';
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/pages/Clubs/GalleryComponent/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as GalleryComponent } from './GalleryComponent';
66 changes: 1 addition & 65 deletions src/pages/Clubs/index.js
Original file line number Diff line number Diff line change
@@ -1,65 +1 @@
import { LoadingScreen } from '@components/LoadingScreen';
import { LocomotiveScrollProvider } from '@context';
import { TransitionColorContext } from '@context/TransitionColorContext';
import useHandleAnimationScroll from '@hooks/useHandleAnimationScroll/useHandlerAnimationScroll.js';
import useMount from '@hooks/useMount/useMount';
import { useContext, useRef } from 'react';
import styled, { useTheme } from 'styled-components';

import Banner from './Banner';
import GalleryComponent from './GalleryComponent';

function ClubsPage() {
const { handleAnimationStart, handleAnimationComplete } = useHandleAnimationScroll();
const { transitionColorHandler } = useContext(TransitionColorContext);
const { color } = useTheme();
const containerRef = useRef(null);

useMount(() => {
transitionColorHandler(color.yellow);
});

return (
<>
<LocomotiveScrollProvider.Horizontal containerRef={containerRef}>
<Container data-scroll-container ref={containerRef} id="#fixed-element-clubs-container">
<Banner />
<GalleryPadding data-scroll-section />
<GalleryComponent />
</Container>
</LocomotiveScrollProvider.Horizontal>
<LoadingScreen
handleAnimationStart={handleAnimationStart}
handleAnimationComplete={handleAnimationComplete}
/>
</>
);
}

export default ClubsPage;

const Container = styled.main`
width: fit-content;
height: 100vh;
display: flex;
font-family: 'Google Sans', sans-serif;
perspective: 1px; // for locomotive-scroll element disappearance bug fix.
background-color: ${(props) => props.theme.backgroundColor.white};
${({ theme }) => theme.tablet`
height: calc(var(--vh, 1vh) * 100);
`}
`;

const GalleryPadding = styled.div`
width: 35vw;
height: 100%;
background: linear-gradient(
to right,
${(props) => props.theme.backgroundColor.white} 0%,
${(props) => props.theme.backgroundColor.black} 100%
);
`;
export { default as ClubsPage } from './ClubsPage';
File renamed without changes.
1 change: 1 addition & 0 deletions src/pages/Developer/Banner/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Banner } from './Banner';
67 changes: 67 additions & 0 deletions src/pages/Developer/DeveloperPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { LoadingScreen } from '@components/LoadingScreen';
import { LocomotiveScrollProvider } from '@context';
import { TransitionColorContext } from '@context/TransitionColorContext';
import { useHandleAnimationScroll, useMount } from '@hooks';
import { useContext, useRef } from 'react';
import styled, { useTheme } from 'styled-components';

import Banner from './Banner/Banner';
import FooterSection from './FooterSection/FooterSection';
import Introduction from './Introduction/Introduction';
import DevRelSection from './JamSection/DevRel';
import FSSection from './JamSection/FS';
import MLSection from './JamSection/ML';
import MobileSection from './JamSection/Mobile';
import ServerSection from './JamSection/Server';
import WebSection from './JamSection/Web';
import SectionIntro from './SectionIntro/SectionIntro';

function DeveloperPage() {
const { handleAnimationStart, handleAnimationComplete } = useHandleAnimationScroll();

const { transitionColorHandler } = useContext(TransitionColorContext);
const { color } = useTheme();
const containerRef = useRef(null);

useMount(() => {
transitionColorHandler(color.green);
});

return (
<>
<LocomotiveScrollProvider.Vertical containerRef={containerRef}>
<Container data-scroll-container ref={containerRef}>
<Banner />
<Introduction />
<SectionIntro />
<WebSection />
<ServerSection />
<MobileSection />
<MLSection />
<FSSection />
<DevRelSection />
<FooterSection />
</Container>
</LocomotiveScrollProvider.Vertical>
<LoadingScreen
handleAnimationStart={handleAnimationStart}
handleAnimationComplete={handleAnimationComplete}
/>
</>
);
}

export default DeveloperPage;

const Container = styled.main`
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
font-family: 'Google Sans', sans-serif;
perspective: 1px; // for locomotive-scroll element disappearance bug fix.
background-color: ${(props) => props.theme.backgroundColor.white};
`;
File renamed without changes.
1 change: 1 addition & 0 deletions src/pages/Developer/FooterSection/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as FooterSection } from './FooterSection';
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useState } from 'react';
import styled from 'styled-components';

import Jam from './Jam/Jam';
import { JamList } from './Jam/JamList';
import { Jam, JamList } from './Jam';

function Introduction() {
const [hoveredSection, setHoveredSection] = useState(null);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Developer/Introduction/Jam/Jam.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import useHover from '@hooks/useHover/useHover';
import { useHover } from '@hooks';
import { IconContext } from '@react-icons/all-files';
import { useCallback } from 'react';
import { useLocomotiveScroll } from 'react-locomotive-scroll';
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Developer/Introduction/Jam/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as Jam } from './Jam';
export { JamList } from './JamList';
1 change: 1 addition & 0 deletions src/pages/Developer/Introduction/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Introduction } from './Introduction';
2 changes: 1 addition & 1 deletion src/pages/Developer/JamSection/DevRel/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import useOnScreen from '@hooks/useOnScreen/useOnScreen';
import { useOnScreen } from '@hooks';
import { useRef } from 'react';
import { TypeAnimation } from 'react-type-animation';
import styled from 'styled-components';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Developer/JamSection/FS/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ReactComponent as SiMongoDB } from '@assets/images/icons/server/mongodb
import { ReactComponent as SiNodeJS } from '@assets/images/icons/web/nodedotjs.svg';
import { ReactComponent as SiReact } from '@assets/images/icons/web/react.svg';
import { ReactComponent as SiTypescript } from '@assets/images/icons/web/typescript.svg';
import useOnScreen from '@hooks/useOnScreen/useOnScreen';
import { useOnScreen } from '@hooks';
import { useRef } from 'react';
import { Tooltip } from 'react-tooltip';
import { TypeAnimation } from 'react-type-animation';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Developer/JamSection/ML/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ReactComponent as SiSklearn } from '@assets/images/icons/ML/scikitlearn
import { ReactComponent as SiTensorflow } from '@assets/images/icons/ML/tensorflow.svg';
// Icon Import
import { ReactComponent as SiPython } from '@assets/images/icons/python.svg';
import useOnScreen from '@hooks/useOnScreen/useOnScreen';
import { useOnScreen } from '@hooks';
import { useRef } from 'react';
import { Tooltip } from 'react-tooltip';
import { TypeAnimation } from 'react-type-animation';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Developer/JamSection/Mobile/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ReactComponent as SiFlutter } from '@assets/images/icons/mobile/flutter
import { ReactComponent as SiUIKit } from '@assets/images/icons/mobile/uikit.svg';
// Icon Import
import { ReactComponent as SiSwift } from '@assets/images/icons/swift.svg';
import useOnScreen from '@hooks/useOnScreen/useOnScreen';
import { useOnScreen } from '@hooks';
import { useRef } from 'react';
import { Tooltip } from 'react-tooltip';
import { TypeAnimation } from 'react-type-animation';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Developer/JamSection/Server/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ReactComponent as SiSQLite } from '@assets/images/icons/server/sqlite.s
import { ReactComponent as SiSymfony } from '@assets/images/icons/server/symfony.svg';
import { ReactComponent as SiSwift } from '@assets/images/icons/swift.svg';
import { ReactComponent as SiNodeJS } from '@assets/images/icons/web/nodedotjs.svg';
import useOnScreen from '@hooks/useOnScreen/useOnScreen';
import { useOnScreen } from '@hooks';
import { SiJavascript } from '@react-icons/all-files/si/SiJavascript';
import { useRef } from 'react';
import { Tooltip } from 'react-tooltip';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Developer/JamSection/Web/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ReactComponent as SiSass } from '@assets/images/icons/web/sass.svg';
import { ReactComponent as SiStyledComponents } from '@assets/images/icons/web/styledcomponents.svg';
import { ReactComponent as SiThreeJS } from '@assets/images/icons/web/threedotjs.svg';
import { ReactComponent as SiVite } from '@assets/images/icons/web/vite.svg';
import useOnScreen from '@hooks/useOnScreen/useOnScreen';
import { useOnScreen } from '@hooks';
import { SiAngular } from '@react-icons/all-files/si/SiAngular';
import { SiBabel } from '@react-icons/all-files/si/SiBabel';
import { SiCss3 } from '@react-icons/all-files/si/SiCss3';
Expand Down
Loading

0 comments on commit f4ef356

Please sign in to comment.