Skip to content

Commit

Permalink
added news page bla bla
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzeysinay committed Sep 26, 2024
1 parent 5adc271 commit ca8afaf
Show file tree
Hide file tree
Showing 19 changed files with 6,259 additions and 1,883 deletions.
6,303 changes: 4,881 additions & 1,422 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@
},
"dependencies": {
"@formspree/react": "^2.4.1",
"@tailwindcss/typography": "^0.5.15",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^5.3.0",
"react-responsive-carousel": "^3.2.23",
"react-router-dom": "^6.26.2",
"recoil": "^0.7.7",
"smoothscroll-polyfill": "^0.4.4"
"smoothscroll-polyfill": "^0.4.4",
"swiper": "^11.1.14"
},
"devDependencies": {
"@formspree/cli": "^0.9.6",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.7"
"tailwindcss": "^3.2.7",
"ts-loader": "^9.5.1"
}
}
Binary file added public/static/images/skylab1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions src/app/news/[id]/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
'use client';

import React, { useState, useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { HiArrowLeft } from 'react-icons/hi';

import './style.css';
import Footer from '@/components/footer/footer';


function NewsDetailPage({ params }) {
const { id } = params;
const router = useRouter();
const [newsData, setNewsData] = useState(null);
const [error, setError] = useState(null);

useEffect(() => {
async function getNewsDetail() {
try {
const res = await fetch(`https://yusufacmaci.com/yildizskylab/news/${id}`);

if (!res.ok) {
throw new Error('Failed to fetch data');
}

const data = await res.json();
setNewsData(data);
} catch (error) {
setError(error);
}
}

getNewsDetail();
}, [id]);

if (error) {
return (
<div className="container mx-auto p-4">
<h1 className="text-2xl font-bold">Haber Yüklenemedi</h1>
<p>{error.message}</p>
</div>
);
}

if (!newsData) {
return (
<div className="container mx-auto p-4">
<p>Yükleniyor...</p>
</div>
);
}

const item = newsData.data;

return (
<div>
{/* Navbar */}
<nav className="fixed top-0 left-0 right-0 text-white p-4 flex items-center">
<button onClick={() => router.back()} className="mr-4">
<HiArrowLeft size={24} />
</button>
<h1 className="text-xl font-bold">Haber Detayı</h1>
</nav>

{/* İçerik */}
<div className="flex justify-center text-center content-center pt-16">
<div className="p-4 text-white custom-prose max-w-3xl">
<h1 className="text-3xl font-bold mb-4">{item.title}</h1>
<p className="text-gray-200 mb-4">
Yayınlanma Tarihi: {new Date(item.publish_date).toLocaleDateString('tr-TR')}
</p>
<div className="mb-4">
<img
src={`data:${item.image_type};base64,${item.image_url}`}
alt={item.title}
className="w-full mx-auto h-auto"
/>
</div>
<div
className="prose prose-lg text-white"
dangerouslySetInnerHTML={{ __html: item.description }}
/>
</div>
</div>
<Footer/>
</div>
);
}

export default NewsDetailPage;
4 changes: 4 additions & 0 deletions src/app/news/[id]/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.custom-prose * {
color: white !important;
align-content: center;
}
18 changes: 12 additions & 6 deletions src/app/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';
import { useRef } from 'react';
import Head from 'next/head';

import LandingPage from '@/components/pages/LandingPage';
import Teams from '@/components/pages/Teams';
import Nav from '@/components/pages/Nav';
Expand All @@ -10,13 +9,18 @@ import Events from '@/components/pages/Events';
import Menu from '@/components/pages/Menu';
import AboutPage from '@/components/pages/About';
import { FormspreeProvider } from '@formspree/react';
import NewsPage from '@/components/pages/News';
import BoardPage from '@/components/pages/board/Board';

function App() {
const landingRef = useRef(null);
const aboutRef = useRef(null);
const teamsRef = useRef(null);
const eventsRef = useRef(null);
const contactRef = useRef(null);
const announcementsRef = useRef(null);
const newsRef = useRef(null);
const boardRef = useRef(null);

return (
<>
Expand All @@ -25,19 +29,21 @@ function App() {
<title>Sky Lab</title>
</Head>
<div className='App'>
<div className='font-bebasNeue relative bg-customDarkPurple flex flex-row justify-center text-customLightPink tracking-[0.16em]'>
<div className='font-bebasNeue relative flex flex-row justify-center text-customLightPink tracking-[0.16em]'>
<Nav
refs={{ aboutRef, landingRef, teamsRef, eventsRef, contactRef }}
refs={{ aboutRef, landingRef, teamsRef, eventsRef, contactRef, announcementsRef, newsRef, boardRef }}
/>
<div className=' h-screen overflow-y-scroll scroll-smooth snap-proximity snap-y justify-center w-full'>
<Menu
refs={{ aboutRef, landingRef, teamsRef, eventsRef, contactRef }}
refs={{ aboutRef, landingRef, teamsRef, eventsRef, contactRef, announcementsRef, newsRef, boardRef }}
/>
<LandingPage ref={landingRef} />
<AboutPage ref={aboutRef} />
<Teams ref={teamsRef} />
<Events ref={eventsRef} />
<Contact ref={contactRef} />
<NewsPage ref={newsRef}/>
<BoardPage ref={boardRef}/>


</div>
</div>
</div>
Expand Down
67 changes: 67 additions & 0 deletions src/components/footer/footer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.footer-cover{
max-height: 40vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 80px;
gap: 80px;
}

.footer-top{
display: flex;
flex-direction: column;
gap: 25px;
}

.footer-logo-container img{
width: 50px;
height: auto;
}

.footer-logo-container{
display: flex;
justify-content: center;
align-items: center;
gap: 100px;
}

.fa-logo-footer{
font-size: 30px;
color: white;
}

.footer-links-icon-container{
display: flex;
justify-content: center;
gap: 25px;
}


.footer-bottom{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 13px;
color: white;
}

.footer-text a{
color: white;
text-decoration: none;
padding: 0;
}


@media only screen and (max-width: 768px){
.footer-bottom{
max-width: 50%;
text-align: center;
height: min-content;
}

.footer-cover{
gap: 40px;
}
}
43 changes: 43 additions & 0 deletions src/components/footer/footer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from "react";
import {
FaDiscord,
FaInstagram,
FaLinkedin,
FaTwitter,
FaYoutube,
} from "react-icons/fa";
import "./footer.css";
import { FaXTwitter } from "react-icons/fa6";

const Footer = () => {
return (
<div className='footer-cover'>
<div className='footer-top'>

<div className='footer-links-icon-container'>
<a href='https://www.instagram.com/ytuskylab'>
<FaInstagram className='fa-logo-footer' />
</a>
<a href='https://www.youtube.com/channel/UCF_qBKpUnM3X_C3L-gLEO4A'>
<FaYoutube className='fa-logo-footer' />
</a>
<a href='https://www.linkedin.com/company/ytuskylab/'>
<FaLinkedin className='fa-logo-footer' />
</a>
<a href='https://discord.com/invite/6jFBjH8y63'>
<FaDiscord className='fa-logo-footer' />
</a>
<a href='https://x.com/skylabkulubu'>
<FaXTwitter className='fa-logo-footer' />
</a>
</div>
</div>

<div className='footer-bottom'>
<p className='footer-year mb-6'>2024</p>
</div>
</div>
);
};

export default Footer;
Binary file added src/components/footer/skylab1.webp
Binary file not shown.
19 changes: 9 additions & 10 deletions src/components/pages/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Image from 'next/image';
// smoothscroll.polyfill();

const Menu = ({
refs: { aboutRef, landingRef, teamsRef, eventsRef, contactRef },
refs: { aboutRef, landingRef, teamsRef, eventsRef, contactRef, announcementsRef, newsRef, boardRef },
}) => {
const [menuOpened, setMenuOpened] = useRecoilState(menuState);
const handleScroll = ref => {
Expand Down Expand Up @@ -55,33 +55,32 @@ const Menu = ({
EKİPLER
</button>
</li>

<li>
<button
className='tracking-[0.10em]'
onClick={() => {
handleScroll(eventsRef);
handleScroll(newsRef);
setMenuOpened(false);
}}
>
ETKİNLİKLER
HABERLER
</button>
</li>
<li>
<button
className='tracking-[0.10em]'
onClick={() => {
handleScroll(contactRef);
handleScroll(boardRef);
setMenuOpened(false);
}}
>
İLETİŞİM
YÖNETİM KURULUMUZ
</button>
</li>
<li className='text-customLightPurple bg-customDarkPurple ring-8 ring-customDarkPurple'>
<a href='#a' className='tracking-[0.10em]'>
KAYIT OL/GİRİŞ YAP
</a>
</li>



</ul>
<div className='absolute w-40 bottom-8'>
<Image src={logo} alt='' />
Expand Down
19 changes: 8 additions & 11 deletions src/components/pages/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Image from 'next/image';
// smoothscroll.polyfill();

const Nav = ({
refs: { aboutRef, landingRef, teamsRef, eventsRef, contactRef },
refs: { aboutRef, landingRef, teamsRef, eventsRef, contactRef, announcementsRef, newsRef, boardRef },
}) => {
const [menuOpened, setMenuOpened] = useRecoilState(menuState);
const handleScroll = ref => {
Expand All @@ -20,7 +20,7 @@ const Nav = ({
}, []);

return (
<div className=' h-24 flex lg:h-36 w-full fixed top-0 flex-row items-center justify-center lg:justify-between container z-50'>
<div className='px-3 h-24 flex lg:h-36 w-full fixed top-0 flex-row items-center justify-center lg:justify-between container z-50'>
<div className='absolute z-40 w-screen h-24 flex items-center'>
<div
onClick={() => setMenuOpened(!menuOpened)}
Expand Down Expand Up @@ -110,27 +110,24 @@ const Nav = ({
EKİPLER
</button>
</li>

<li>
<button
className='tracking-[0.10em]'
onClick={() => handleScroll(eventsRef)}
onClick={() => handleScroll(newsRef)}
>
ETKİNLİKLER
HABERLER
</button>
</li>
<li>
<button
className='tracking-[0.10em]'
onClick={() => handleScroll(contactRef)}
onClick={() => handleScroll(boardRef)}
>
İLETİŞİM
YÖNETİM KURULUMUZ
</button>
</li>
<li className='text-customAccent'>
<a href='#' className='tracking-[0.10em]'>
KAYIT OL/GİRİŞ YAP
</a>
</li>

</ul>
</div>
);
Expand Down
Loading

0 comments on commit ca8afaf

Please sign in to comment.