1- " use client" ;
1+ ' use client' ;
22import { Hubballi } from "next/font/google" ;
3- import React , { ReactNode } from "react" ;
3+ import React from "react" ;
44import "./globals.css" ;
55import Link from "next/link" ;
66import { GoogleAnalytics } from "@next/third-parties/google" ;
7-
87import SocialMediaButton from "../components/SocialMediaButton" ;
9-
108import { links } from "../data/links" ;
11-
12- interface RootLayoutProps {
13- children : ReactNode ;
14- }
9+ import { useTab , TabProvider } from "../context/TabContext" ;
1510
1611const hubballi = Hubballi ( {
17- weight : [ "400" ] ,
18- subsets : [ "latin" ] ,
12+ weight : [ "400" ] ,
13+ subsets : [ "latin" ] ,
1914} ) ;
2015
21- export default function RootLayout ( { children } : RootLayoutProps ) {
22- return (
23- < html lang = "en" >
24- < body className = { `${ hubballi . className } ` } >
25- < GoogleAnalytics gaId = "G-B1TRQFQPF3" />
26- < div className = "max-w-screen-xl w-full flex lg:flex-row md:flex-row flex-col items-center mx-auto gap-y-10 gap-x-5 mt-12 px-5" >
27- < img
28- src = "/img/github_photo.png"
29- width = { 400 }
30- height = { 419 }
31- alt = "Haries' Profile Picture"
32- style = { { borderRadius : "50%" } }
33- />
34- < div className = "flex flex-col" >
35- < p style = { { fontSize : 50 } } className = "leading-10 mb-4" >
36- Hi! I am{ " " }
37- < span className = "text-gray-300" > Muhamad</ span > { " " }
38- Haries{ " " }
39- < span className = "text-gray-300" > Ramdhani</ span >
40- </ p >
41- < div className = "flex flex-row gap-x-2 mb-8" >
42- { links . map ( ( link ) => (
43- < SocialMediaButton
44- key = { link . image_filename }
45- url = { link . url }
46- image_filename = { link . image_filename }
47- />
48- ) ) }
49- </ div >
50- < p
16+ function NavItems ( ) {
17+ const { setActiveTab, activeTab } = useTab ( ) ;
18+
19+ const tabs = [
20+ { id : 'projects' , label : 'Side Projects' } ,
21+ { id : 'blog' , label : 'Blog' , externalUrl : 'https://hariesramdhani.github.io/writing' } ,
22+ // { id: 'research', label: 'Research' },
23+ // { id: 'presentation', label: 'Presentation' },
24+ // { id: 'teaching', label: 'Teaching' },
25+ ] ;
26+
27+ const handleTabClick = ( tab : { id : string ; externalUrl ?: string } ) => {
28+ if ( tab . externalUrl ) {
29+ window . location . href = tab . externalUrl ;
30+ } else {
31+ setActiveTab ( tab . id ) ;
32+ }
33+ } ;
34+
35+ return (
36+ < div className = "flex flex-wrap gap-x-8" >
37+ { tabs . map ( ( tab ) => (
38+ < button
39+ key = { tab . id }
40+ onClick = { ( ) => handleTabClick ( tab ) }
41+ className = { `mb-5 px-2 rounded-lg ${ activeTab === tab . id ? 'bg-gray-200' : 'text-gray-400' } ` }
42+ style = { { fontSize : 24 } }
43+ >
44+ { tab . label }
45+ </ button >
46+ ) ) }
47+ </ div >
48+ ) ;
49+ }
50+
51+ export default function RootLayout ( { children } : { children : React . ReactNode } ) {
52+ return (
53+ < html lang = "en" >
54+ < body className = { `${ hubballi . className } ` } >
55+ < GoogleAnalytics gaId = "G-B1TRQFQPF3" />
56+ < TabProvider >
57+ < div className = "max-w-screen-xl w-full flex lg:flex-row md:flex-row flex-col items-center mx-auto gap-y-10 gap-x-5 mt-12 px-5" >
58+ < img
59+ src = "/img/github_photo.png"
60+ width = { 400 }
61+ height = { 419 }
62+ alt = "Haries' Profile Picture"
63+ style = { { borderRadius : "50%" } }
64+ />
65+ < div className = "flex flex-col" >
66+ < p style = { { fontSize : 50 } } className = "leading-10 mb-4" >
67+ Hi! I am < span className = "text-gray-300" > M.</ span > Haries{ " " }
68+ < span className = "text-gray-300" > Ramdhani</ span >
69+ </ p >
70+ < div className = "flex flex-row gap-x-2 mb-8" >
71+ { links . map ( ( link ) => (
72+ < SocialMediaButton
73+ key = { link . image_filename }
74+ url = { link . url }
75+ image_filename = { link . image_filename }
76+ />
77+ ) ) }
78+ </ div >
79+ < p
5180 style = { { fontSize : 24 } }
5281 className = "leading-7 text-justify"
5382 >
@@ -72,7 +101,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
72101 href = "https://www.abdn.ac.uk/ims/profiles/c.debari"
73102 className = "text-indigo-400"
74103 >
75- Prof. Casimo de Bari
104+ Prof. Cosimo de Bari
76105 </ Link >
77106 . My research interests are in bioinformatics
78107 software and algorithm development, also the
@@ -119,52 +148,19 @@ export default function RootLayout({ children }: RootLayoutProps) {
119148 </ Link > { " " }
120149 through the IMS studentship.
121150 </ p >
122- </ div >
123- </ div >
124- < div className = "max-w-screen-xl w-full flex flex-col items-start gap-x-5 mt-12 mx-auto px-5" >
125- < div className = "flex flex-wrap gap-x-8" >
126- < Link href = "/" >
127- < h1
128- style = { { fontSize : 24 } }
129- className = "mb-5 px-2 bg-gray-200 rounded-lg"
130- >
131- Side Projects
132- </ h1 >
133- </ Link >
134- < h1
135- style = { { fontSize : 24 } }
136- className = "mb-5 text-gray-400"
137- >
138- Blog
139- </ h1 >
140- < h1
141- style = { { fontSize : 24 } }
142- className = "mb-5 text-gray-400"
143- >
144- Research
145- </ h1 >
146- < h1
147- style = { { fontSize : 24 } }
148- className = "mb-5 text-gray-400"
149- >
150- Presentation
151- </ h1 >
152- < h1
153- style = { { fontSize : 24 } }
154- className = "mb-5 text-gray-400"
155- >
156- Teaching
157- </ h1 >
158- </ div >
159-
160- < div className = "w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-10 gap-y-4" >
161- { children }
162- </ div >
163- </ div >
164- < div className = "max-w-screen-xl w-full flex flex-col items-center gap-x-5 mt-12 mx-auto px-5" >
165- < p > Haries Ramdhani © 2024.</ p >
166- </ div >
167- </ body >
168- </ html >
169- ) ;
170- }
151+ </ div >
152+ </ div >
153+ < div className = "max-w-screen-xl w-full flex flex-col items-start gap-x-5 mt-12 mx-auto px-5" >
154+ < NavItems />
155+ < div className = "w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-10 gap-y-4" >
156+ { children }
157+ </ div >
158+ </ div >
159+ < div className = "max-w-screen-xl w-full flex flex-col items-center gap-x-5 mt-12 mx-auto px-5" >
160+ < p > Haries Ramdhani © 2025.</ p >
161+ </ div >
162+ </ TabProvider >
163+ </ body >
164+ </ html >
165+ ) ;
166+ }
0 commit comments