Skip to content

Commit

Permalink
Merge pull request #33 from DWE-CLOUD/main
Browse files Browse the repository at this point in the history
feat: Added routing and minor changes
  • Loading branch information
yogita005 authored Sep 15, 2024
2 parents ab80471 + 08e6636 commit 7b9a2ee
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 99 deletions.
2 changes: 1 addition & 1 deletion client/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import React, { useEffect } from "react"; // Removed useState
import React, { useEffect } from "react";
import Header from "@/components/home/header";
import Introduction from "@/components/home/introduction";
import History from "@/components/home/history";
Expand Down
87 changes: 54 additions & 33 deletions client/src/components/domainsections/domain.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,63 @@
import Navbar from "@/components/navbar";
"use client";
import Header from "@/components/home/header";
import Image from "next/image";
import React from "react";
import { motion } from "framer-motion";

type DomainProps = {
imgSrc: string;
altText: string;
sections: { heading: string; content: string }[];
imgSrc: string;
altText: string;
sections: { heading: string; content: string }[];
};

export default function Domain({ imgSrc, altText, sections }: DomainProps) {
return (
<div className="min-h-screen bg-[#11071F] pb-12 xl:pb-96">
<Navbar />
<div className="p-12 flex flex-col gap-16 xl:gap-28">
<Image
className="absolute z-10 w-60 lg:w-96"
src={imgSrc}
alt={altText}
width={500}
height={500}
/>
return (
<div className="min-h-screen bg-[#11071F] pb-12 xl:pb-40 relative">
<Header />
<div className="p-6 flex flex-col gap-10 xl:gap-16 relative z-20">
<motion.div
className="absolute z-10 w-60 lg:w-96"
initial={{ opacity: 0, y: -50 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.8, ease: "easeOut" }}
>
<Image
src={imgSrc}
alt={altText}
width={500}
height={500}
/>
</motion.div>

{sections.map((section, index) => (
<div key={index} className="z-50 flex flex-col items-center justify-center content">
<h1 className="text-white text-2xl lg:text-5xl font-semibold font-Montserrat">
{section.heading}
</h1>
<h2 className="text-white text-base text-center lg:text-2xl font-semibold w-2/3 mt-16 font-Montserrat">
{section.content.split("\n").map((line, lineIndex) => (
<React.Fragment key={lineIndex}>
{line}
<br />
</React.Fragment>
))}
</h2>
</div>
))}
</div>
</div>
);
{sections.map((section, index) => (
<motion.div
key={index}
className="z-50 flex flex-col items-center justify-center text-center mt-24" // Added margin-top to move title down
initial={{ opacity: 0, y: 50 }}
whileInView={{ opacity: 1, y: 0 }}
transition={{ duration: 0.8, ease: "easeOut", delay: index * 0.2 }}
>
<h1 className="text-white text-xl md:text-3xl lg:text-4xl font-bold font-Montserrat">
{section.heading}
</h1>

<h2 className="text-white text-sm md:text-lg lg:text-xl mt-6 font-light leading-relaxed w-4/5 md:w-3/5 font-Montserrat">
{section.content.split("\n").map((line, lineIndex) => (
<motion.div
key={lineIndex}
className="mb-2"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.5, delay: lineIndex * 0.1 }}
>
{line}
<br />
</motion.div>
))}
</h2>
</motion.div>
))}
</div>
</div>
);
}
47 changes: 25 additions & 22 deletions client/src/components/home/domain-cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React from 'react';
import { motion } from 'framer-motion';
import Image from 'next/image';
import Link from 'next/link';

type Domain = {
title: string;
Expand Down Expand Up @@ -43,31 +44,33 @@ type DomainCardProps = {
};

const DomainCard: React.FC<DomainCardProps> = ({ domain, index }) => (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: index * 0.1 }}
className="bg-purple-950 bg-opacity-40 backdrop-blur-sm rounded-lg p-4 sm:p-6 flex flex-col items-center sm:flex-row sm:items-start space-y-4 sm:space-y-0 sm:space-x-6 hover:bg-opacity-60 transition-all duration-300"
>
<Link href={`/${domain.title.toLowerCase()}`} passHref>
<motion.div
whileHover={{ scale: 1.1 }}
className={`bg-gradient-to-br ${domain.gradient} p-2 sm:p-4 rounded-full shadow-lg shadow-purple-500/50 flex items-center justify-center relative w-10 sm:w-16 h-10 sm:h-16`}
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: index * 0.1 }}
className="cursor-pointer bg-purple-950 bg-opacity-40 backdrop-blur-sm rounded-lg p-4 sm:p-6 flex flex-col items-center sm:flex-row sm:items-start space-y-4 sm:space-y-0 sm:space-x-6 hover:bg-opacity-60 transition-all duration-300"
>
<Image src={domain.image} alt={domain.title} width={24} height={24} className="z-10" />
<div className="absolute inset-0 rounded-full bg-white opacity-10 blur-md"></div>
</motion.div>
<div className="text-center sm:text-left">
<h3 className="text-white text-lg sm:text-xl font-semibold">{domain.title}</h3>
<p className="text-purple-300 text-xs sm:text-sm">{domain.description}</p>
<motion.button
whileHover={{ scale: 1.05, backgroundColor: '#3B0764' }}
whileTap={{ scale: 0.95 }}
className="mt-2 sm:mt-4 px-3 sm:px-4 py-1 sm:py-2 bg-purple-900 text-white rounded-md text-xs sm:text-sm transition-colors duration-300"
<motion.div
whileHover={{ scale: 1.1 }}
className={`bg-gradient-to-br ${domain.gradient} p-2 sm:p-4 rounded-full shadow-lg shadow-purple-500/50 flex items-center justify-center relative w-10 sm:w-16 h-10 sm:h-16`}
>
LEARN MORE
</motion.button>
</div>
</motion.div>
<Image src={domain.image} alt={domain.title} width={24} height={24} className="z-10" />
<div className="absolute inset-0 rounded-full bg-white opacity-10 blur-md"></div>
</motion.div>
<div className="text-center sm:text-left">
<h3 className="text-white text-lg sm:text-xl font-semibold">{domain.title}</h3>
<p className="text-purple-300 text-xs sm:text-sm">{domain.description}</p>
<motion.button
whileHover={{ scale: 1.05, backgroundColor: '#3B0764' }}
whileTap={{ scale: 0.95 }}
className="mt-2 sm:mt-4 px-3 sm:px-4 py-1 sm:py-2 bg-purple-900 text-white rounded-md text-xs sm:text-sm transition-colors duration-300"
>
LEARN MORE
</motion.button>
</div>
</motion.div>
</Link>
);

const DomainsComponent = () => {
Expand Down
86 changes: 43 additions & 43 deletions client/src/components/home/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ const Header: React.FC = () => {
const toggleMenu = () => {
setIsMenuOpen(!isMenuOpen);
};

const menuIconVariants = {
open: {
rotate: 90,
transition: { duration: 0.3 }
},
closed: {
rotate: 0,
transition: { duration: 0.3 }
}
open: { rotate: 90, transition: { duration: 0.3 } },
closed: { rotate: 0, transition: { duration: 0.3 } }
};

return (
Expand All @@ -27,86 +22,91 @@ const Header: React.FC = () => {
<div className="flex items-center">
<motion.div
className="w-12 h-12 mr-4"
initial={{opacity: 0, scale: 0.8}}
animate={{opacity: 1, scale: 1}}
transition={{duration: 0.8, delay: 0.1}}
initial={{ opacity: 0, scale: 0.8 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ duration: 0.8, delay: 0.1 }}
>
<Image src={Logo} alt="Logo" layout="responsive" width={48} height={48}/>
<Image src={Logo} alt="Logo" layout="responsive" width={48} height={48} />
</motion.div>
<motion.div
className="text-xl font-bold"
initial={{opacity: 0, y: -20}}
animate={{opacity: 1, y: 0}}
transition={{duration: 0.8, delay: 0.2}}
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.8, delay: 0.2 }}
>
<span className="text-white">Data</span>
<motion.span
className="text-[#8B55E9]"
initial={{opacity: 0, x: -10}}
animate={{opacity: 1, x: 0}}
transition={{duration: 0.8, delay: 0.4}}
> Science
initial={{ opacity: 0, x: -10 }}
animate={{ opacity: 1, x: 0 }}
transition={{ duration: 0.8, delay: 0.4 }}
>
Science
</motion.span>
<br />
Community{" "}
<motion.span
className="text-[#8B55E9]"
initial={{ opacity: 0, x: 10 }}
animate={{ opacity: 1, x: 0 }}
transition={{ duration: 0.8, delay: 0.6 }}
>
SRM
</motion.span>
<br/>
Community <motion.span
className="text-[#8B55E9]"
initial={{opacity: 0, x: 10}}
animate={{opacity: 1, x: 0}}
transition={{duration: 0.8, delay: 0.6}}
>SRM</motion.span>
</motion.div>
</div>
<motion.button
className="sm:hidden flex items-center px-3 py-2 border rounded text-white border-white"
onClick={toggleMenu}
whileHover={{scale: 1.1}}
whileTap={{scale: 0.9}}
whileHover={{ scale: 1.1 }}
whileTap={{ scale: 0.9 }}
variants={menuIconVariants}
initial={{opacity: 0, scale: 0.8}}
animate={isMenuOpen ? {opacity: 1, scale: 1, rotate: 90} : {opacity: 1, scale: 1, rotate: 0}}
transition={{duration: 0.8, delay: 0.7}}
initial="closed"
animate={isMenuOpen ? "open" : "closed"}
transition={{ duration: 0.8, delay: 0.7 }}
>
<svg className="fill-current h-5 w-5" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<title>Menu</title>
<path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/>
<path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z" />
</svg>
</motion.button>

<nav className="hidden sm:flex">
<motion.a
href="#"
className="mx-2 px-4 py-2 text-sm rounded-full bg-[#8B55E9] bg-opacity-20 hover:bg-opacity-50 transition-colors duration-300"
whileHover={{scale: 1.05}}
whileTap={{scale: 0.95}}
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
>
Home
</motion.a>
<motion.a
href="#"
className="mx-2 px-4 py-2 text-sm rounded-full bg-[#8B55E9] bg-opacity-20 hover:bg-opacity-50 transition-colors duration-300"
whileHover={{scale: 1.05}}
whileTap={{scale: 0.95}}
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
>
About Us
</motion.a>
</nav>
</div>

{isMenuOpen && (
<motion.div
className="fixed inset-0 bg-black bg-opacity-50 z-40"
initial={{opacity: 0}}
animate={{opacity: 1}}
exit={{opacity: 0}}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
onClick={toggleMenu}
/>
)}

<motion.div
className={`fixed top-0 left-0 h-full w-64 bg-[#1A0B2E] text-white z-50 rounded-r-lg shadow-lg transform ${
isMenuOpen ? 'translate-x-0' : '-translate-x-full'
isMenuOpen ? "translate-x-0" : "-translate-x-full"
}`}
initial={{x: '-100%', opacity: 0}}
animate={{ x: isMenuOpen ? '0%' : '-100%', opacity: isMenuOpen ? 1 : 0 }}
initial={{ x: "-100%", opacity: 0 }}
animate={{ x: isMenuOpen ? "0%" : "-100%", opacity: isMenuOpen ? 1 : 0 }}
transition={{ type: "spring", stiffness: 80 }}
>
<div className="p-4">
Expand Down Expand Up @@ -148,4 +148,4 @@ const Header: React.FC = () => {
);
};

export default Header;
export default Header;

0 comments on commit 7b9a2ee

Please sign in to comment.