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

Lore section Mobile responsiveness #7

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fa7f553
Update CONTRIBUTING.md: Remove unnecessary lines
ArjunQBTech Oct 21, 2024
8cbaa29
Add local deployment script and fix ref assignment in GamePlayCardList
ArjunQBTech Oct 21, 2024
47126a3
Refactor landing page CSS: Remove unnecessary outline classes
ArjunQBTech Oct 21, 2024
3ebb381
Refactor landing page CSS: Remove unnecessary outline classes and fix…
ArjunQBTech Oct 21, 2024
9668e9f
Refactor CSS: Update landing page styles and add mobile gameplay mech…
ArjunQBTech Oct 22, 2024
880f9e4
Refactor Card component: Improve code readability and add JSDoc comments
ArjunQBTech Oct 22, 2024
030d6a2
Refactor Card component: Improve JSDoc comments and code readability
ArjunQBTech Oct 22, 2024
584b574
Refactor Cover component: Improve code readability and add JSDoc comm…
ArjunQBTech Oct 22, 2024
318cafd
Refactor landing page: Update GamePlayMechanics component and handle …
ArjunQBTech Oct 22, 2024
8762217
Refactor landing page: Remove unused state and optimize window resize…
ArjunQBTech Oct 22, 2024
cbe4cca
Refactor Landing and PatternCover components: Improve code readabilit…
ArjunQBTech Oct 22, 2024
924f8c4
Refactor Button component: Improve code readability and add JSDoc com…
ArjunQBTech Oct 22, 2024
7f4ebae
Refactor GamePlayMechanics component: Remove unused imports and fix f…
ArjunQBTech Oct 22, 2024
f9aa104
issue 1 and issue 2 resolved
MohitQuadB Oct 22, 2024
205f3d8
lore section responsive
MohitQuadB Oct 23, 2024
75a3348
Merge pull request #4 from ICP-hub/ui/GameplayMobile
ArjunQBTech Oct 24, 2024
228a780
Merge branch 'ICP-hub:master' into master
MohitQuadB Oct 24, 2024
27ec146
lore section Mobile view Responsive work completed
MohitQuadB Oct 28, 2024
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: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# Contributing Guidelines

Thank you for your interest in contributing to our project! To maintain consistency and quality across the codebase, please follow these guidelines when contributing.
Expand Down
43 changes: 23 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions scripts/local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Start the local replica
dfx start --background

# Install the project dependencies
npm install

# Deploy the project
dfx deploy
8 changes: 7 additions & 1 deletion src/StarDustAdventures_frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
"@dfinity/auth-client": "^2.1.2",
"@dfinity/candid": "^0.15.7",
"@dfinity/principal": "^0.15.7",
"aos": "^2.3.4",
"clsx": "^2.1.1",
"framer-motion": "^11.11.9",
"gsap": "^3.12.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.4.1",
"react-icons": "^5.3.0"
"react-icons": "^5.3.0",
"react-router-dom": "^6.27.0",
"vite-plugin-compression": "^0.5.1"
},
"devDependencies": {
"@types/react": "^18.2.14",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.mob-gameplay-card{
@apply w-screen flex flex-col justify-start items-center gap-8
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { CardProps } from "../../../landing/gamePlayMechanics/Cards";
import './index.css';

/**
* A Card component that displays a gameplay mechanic.
* It includes an image, title, and description.
*
* @param {CardProps} props - The card properties.
* @param {string} props.title - The title of the card.
* @param {string} props.description - The description of the gameplay mechanic.
* @param {string} props.image - The image URL representing the gameplay mechanic.
* @returns {JSX.Element} A styled card with an image, title, and description.
*/
export default function Card({ title, description, image }: CardProps): JSX.Element {
return (
<div aria-roledescription='card' role="region" className="mob-gameplay-card">
<img src={image} alt={title} title={title} width={86} height={86} />
<h4 className='card-title'>{title}</h4>
<p className='card-description'>{description}</p>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.mob-gameplay-container{
@apply min-h-screen h-auto relative;
}

.mob-gameplay-header{
@apply relative h-screen min-h-fit flex flex-col justify-center z-[100];
scroll-snap-align:center;
}

.gameplay-mechanics-cards-list{
@apply mt-4 flex justify-between items-center w-[300vw]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { useEffect, useRef } from "react";
import { CARDS } from "../../landing/gamePlayMechanics";
import Card from "./Card";
import './index.css';
import gsap from "gsap";
import { ScrollTrigger } from 'gsap/ScrollTrigger';

gsap.registerPlugin(ScrollTrigger);

/**
* Renders the header for gameplay mechanics.
* @param {Object} props - Component props
* @param {React.RefObject<HTMLDivElement>} props.headerRef - Ref for the header container
*/
const Header = ({ headerRef }: { headerRef: React.RefObject<HTMLDivElement> }) => {
return (
<div className='mob-gameplay-header' ref={headerRef}>
<h3 className='section-title'>Gameplay Mechanics</h3>
<p className='section-caption'>Explore the engaging system of Star Dust Adventures</p>
</div>
);
};

/**
* Renders a list of gameplay mechanic cards.
* @param {Object} props - Component props
* @param {React.RefObject<HTMLDivElement>} props.cardsRef - Ref for the cards container
*/
const CardList = ({ cardsRef }: { cardsRef: React.RefObject<HTMLDivElement> }) => {
return (
<div className="gameplay-mechanics-cards-list" ref={cardsRef}>
{CARDS.map((card, index) => (
<Card {...card} key={index} />
))}
</div>
);
};

/**
* Renders the Gameplay Mechanics section with GSAP animations and ScrollTrigger.
*/
const GameplayMechanics = () => {
const headerRef = useRef<HTMLDivElement>(null);
const containerRef = useRef<HTMLElement>(null);
const cardsRef = useRef<HTMLDivElement>(null);

useEffect(() => {
if (headerRef.current && containerRef.current && cardsRef.current) {
const tl = gsap.timeline({
scrollTrigger: {
trigger: containerRef.current,
start: "top top",
end: "bottom bottom",
scrub: true,
pin: true,
anticipatePin: 1,
}
});

// Header animation
tl.fromTo(headerRef.current, { x: '100%', height: '100vh' }, { x: 0, height: 0, duration: 1 });

// Cards animation
const cards = cardsRef.current.querySelectorAll(".mob-gameplay-card");
tl.fromTo(cards,
{ opacity: 0.8, scale: 0.8 },
{ xPercent: -100 * (cards.length - 1), ease: "none", opacity: 1, scale: 1 }
);

return () => {
ScrollTrigger.getAll().forEach(trigger => trigger.kill());
};
}
}, []);

return (
<section className='mob-gameplay-container' ref={containerRef}>
<Header headerRef={headerRef} />
<CardList cardsRef={cardsRef} />
</section>
);
};

export default GameplayMechanics;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.gradient-cover{
@apply outline outline-lime-50 md:min-h-screen h-auto w-screen relative bg-black flex flex-col justify-between lg:gap-32
@apply md:min-h-screen h-auto w-screen relative bg-black flex flex-col justify-between lg:gap-32;
scroll-snap-type: y mandatory;
}

.right-purple-pattern{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import React from 'react';
import './index.css'
export default function Cover({children} : React.PropsWithChildren<{}>){
return(
import './index.css';

/**
* A Cover component that wraps its children with a gradient background and patterned decorations.
*
* @param {React.PropsWithChildren<{}>} props - The props containing children elements.
* @param {React.ReactNode} props.children - The content to be rendered inside the cover.
* @returns {JSX.Element} A styled cover with children content.
*/
export default function Cover({ children }: React.PropsWithChildren<{}>): JSX.Element {
return (
<div className="gradient-cover">
<div className="right-purple-pattern">
<img src="/assets/images/square.svg" alt="purple-pattern" style={{display:'none'}} />
<div className="square-purple" style={{background:"url('/assets/images/square.svg')"}}></div>
<img src="/assets/images/square.svg" alt="purple-pattern" style={{ display: 'none' }} />
<div className="square-purple" style={{ background: "url('/assets/images/square.svg')" }}></div>
</div>
<div className="left-blue-pattern">
<img src="/assets/images/squares-left.svg" alt="blue-pattern" style={{display:'none'}} />
<div className="square-blue" style={{background:"url('/assets/images/squares-left.svg')"}}></div>
<img src="/assets/images/squares-left.svg" alt="blue-pattern" style={{ display: 'none' }} />
<div className="square-blue" style={{ background: "url('/assets/images/squares-left.svg')" }}></div>
</div>
{children}
</div>
)
}
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.gameplay-card{
@apply relative flex flex-col lg:px-3 lg:py-4 justify-start items-center
bg-transparent lg:gap-7 text-white lg:h-[50vh] z-[1] md:w-auto w-screen
bg-transparent lg:gap-7 text-white lg:h-[50vh] z-[1] w-auto
}

.card-title{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ export type CardProps = {
image : string;
}

/*
* Card Component
* - Component that renders a card with an image, title, and description
* - Returns a div with an image, title, and description
* - Used in Landing Page
*/

/**
* A Card component that displays a gameplay mechanic for desktop view.
* It includes an image, title, and description.
*
* @param {CardProps} props - The card properties.
* @param {string} props.title - The title of the card.
* @param {string} props.description - The description of the gameplay mechanic.
* @param {string} props.image - The image URL representing the gameplay mechanic.
* @returns {JSX.Element} A styled card with an image, title, and description for large screen sizes ( > 768px).
*/
const Card = ({title, description,image}:CardProps)=>{
return(
<div aria-roledescription='Gameplay Card' className="gameplay-card">
<div aria-roledescription='card' role='section' className="gameplay-card">
<img src={image} alt={title} title={title} width={86} height={86}/>
<h4 className='card-title'>{title}</h4>
<p className='card-description'>{description}</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.gameplay-mechanics {
@apply w-full bg-transparent lg:mt-24 mt-12 text-white flex flex-col items-center justify-center py-3 md:min-h-min min-h-screen md:max-h-screen h-auto relative

@apply w-full bg-transparent lg:mt-24 mt-12 text-white flex flex-col items-center justify-center py-3 max-h-screen h-auto relative
;
}

Expand All @@ -9,8 +8,8 @@
}

.gameplay-mechanics-cards {
@apply flex md:flex-1 flex-row md:justify-between justify-center md:items-center items-center gap-6 relative mt-2 md:w-full w-[300vw] md:h-auto h-screen
overflow-x-hidden px-2 outline outline-red-500 ;
@apply flex md:flex-1 flex-row md:justify-between justify-center md:items-center items-center gap-6 relative mt-2 w-full h-auto
overflow-x-hidden px-2 ;
}

.section-title {
Expand Down
Loading
Loading