Skip to content

Commit ad1e5d2

Browse files
committed
Basic template
1 parent f3394dd commit ad1e5d2

24 files changed

+1511
-159
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": ["next/core-web-vitals", "plugin:prettier/recommended"]
33
}

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.next
2+
/build
3+
/node_modules
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { useLanguageStore } from '@/store/language';
2+
import dataES from '@/data/es/data';
3+
import dataEN from '@/data/en/data';
4+
5+
const BtnLanguage = () => {
6+
const { language, setLanguage, setData } = useLanguageStore();
7+
8+
const handleLanguage = () => {
9+
setLanguage(language === 'ES' ? 'EN' : 'ES');
10+
setData(language === 'ES' ? dataES : dataEN);
11+
};
12+
13+
return <button onClick={handleLanguage}>{language}</button>;
14+
};
15+
16+
export default BtnLanguage;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use client';
2+
3+
import { useState, useEffect } from 'react';
4+
import { useTheme } from 'next-themes';
5+
import { IconDark, IconLight } from '../../icons';
6+
7+
const BtnTheme = () => {
8+
const [mounted, setMounted] = useState(false);
9+
const { theme, setTheme } = useTheme();
10+
11+
useEffect(() => {
12+
setMounted(true);
13+
}, []);
14+
15+
const handleTheme = () => {
16+
return setTheme(theme === 'dark' ? 'light' : 'dark');
17+
};
18+
19+
if (!mounted) {
20+
return (
21+
<button className="bg-gray-200 rounded-lg dark:bg-neutral-800 px-1.5 py-1.5 hover:ring-2 ring-gray-300 transition-all">
22+
<span className="block w-5 h-5"></span>
23+
</button>
24+
);
25+
}
26+
27+
return (
28+
<button
29+
className="bg-gray-200 rounded-lg dark:bg-neutral-800 px-1.5 py-1.5 hover:ring-2 ring-gray-300 transition-all"
30+
onClick={handleTheme}
31+
>
32+
{theme === 'light' ? <IconDark /> : <IconLight />}
33+
</button>
34+
);
35+
};
36+
37+
export default BtnTheme;

app/components/header/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use client';
2+
3+
import Link from 'next/link';
4+
import BtnLanguage from './_children/btn-language';
5+
import BtnTheme from './_children/btn-theme';
6+
import useTranslate from '@/hooks/useTranslate';
7+
8+
const Header = () => {
9+
const { translate } = useTranslate();
10+
return (
11+
<header className="flex items-center justify-between flex-row w-full py-4 border-b border-neutral-100 dark:border-neutral-800">
12+
<nav className="w-8/12">
13+
<ul className="flex flex-row gap-4">
14+
<li className="font-semibold text-neutral-800 dark:text-white">
15+
<Link href="#about">{translate('about')}</Link>
16+
</li>
17+
<li className="font-normal text-neutral-600 dark:text-neutral-500">
18+
{translate('experience')}
19+
</li>
20+
<li className="font-normal text-neutral-600 dark:text-neutral-500">
21+
{translate('proyects')}
22+
</li>
23+
<li className="font-normal text-neutral-600 dark:text-neutral-500">
24+
{translate('skills')}
25+
</li>
26+
</ul>
27+
</nav>
28+
<div className="btn-actions flex flex-row justify-end gap-4 w-4/12">
29+
<BtnLanguage />
30+
<BtnTheme />
31+
</div>
32+
</header>
33+
);
34+
};
35+
36+
export default Header;

app/components/icons/index.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
export const IconDark = () => {
2+
return (
3+
<svg
4+
xmlns="http://www.w3.org/2000/svg"
5+
width="20"
6+
height="20"
7+
viewBox="0 0 24 24"
8+
fill="none"
9+
stroke="currentColor"
10+
strokeWidth="1.8"
11+
strokeLinecap="round"
12+
strokeLinejoin="round"
13+
>
14+
<path d="M12 3a6.364 6.364 0 0 0 9 9 9 9 0 1 1-9-9Z"></path>
15+
</svg>
16+
);
17+
};
18+
19+
export const IconLight = () => {
20+
return (
21+
<svg
22+
xmlns="http://www.w3.org/2000/svg"
23+
width="20"
24+
height="20"
25+
viewBox="0 0 24 24"
26+
fill="none"
27+
stroke="currentColor"
28+
strokeWidth="1.8"
29+
strokeLinecap="round"
30+
strokeLinejoin="round"
31+
>
32+
<circle cx="12" cy="12" r="4"></circle>
33+
<path d="M12 2v2"></path>
34+
<path d="M12 20v2"></path>
35+
<path d="m4.93 4.93 1.41 1.41"></path>
36+
<path d="m17.66 17.66 1.41 1.41"></path>
37+
<path d="M2 12h2"></path>
38+
<path d="M20 12h2"></path>
39+
<path d="m6.34 17.66-1.41 1.41"></path>
40+
<path d="m19.07 4.93-1.41 1.41"></path>
41+
</svg>
42+
);
43+
};

app/globals.css

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4-
5-
:root {
6-
--foreground-rgb: 0, 0, 0;
7-
--background-start-rgb: 214, 219, 220;
8-
--background-end-rgb: 255, 255, 255;
9-
}
10-
11-
@media (prefers-color-scheme: dark) {
12-
:root {
13-
--foreground-rgb: 255, 255, 255;
14-
--background-start-rgb: 0, 0, 0;
15-
--background-end-rgb: 0, 0, 0;
16-
}
17-
}
18-
19-
body {
20-
color: rgb(var(--foreground-rgb));
21-
background: linear-gradient(
22-
to bottom,
23-
transparent,
24-
rgb(var(--background-end-rgb))
25-
)
26-
rgb(var(--background-start-rgb));
27-
}

app/layout.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,37 @@
1-
import './globals.css'
2-
import { Inter } from 'next/font/google'
1+
import localFont from 'next/font/local';
2+
import './globals.css';
3+
import { Providers } from './provider';
34

4-
const inter = Inter({ subsets: ['latin'] })
5+
const graphik = localFont({
6+
src: [
7+
{
8+
path: '../public/fonts/Graphik-Regular.ttf',
9+
weight: '400',
10+
style: 'normal'
11+
},
12+
{
13+
path: '../public/fonts/Graphik-Medium.ttf',
14+
weight: '600',
15+
style: 'bold'
16+
}
17+
],
18+
variable: '--font-graphik',
19+
display: 'swap'
20+
});
521

622
export const metadata = {
723
title: 'Create Next App',
8-
description: 'Generated by create next app',
9-
}
24+
description: 'Generated by create next app'
25+
};
1026

1127
export default function RootLayout({ children }) {
1228
return (
13-
<html lang="en">
14-
<body className={inter.className}>{children}</body>
29+
<html lang="en" className={`${graphik.variable}`} suppressHydrationWarning>
30+
<body className="text-black bg-white dark:text-white dark:bg-[#111010]">
31+
<Providers>
32+
<div className="px-8 max-w-[1100px] mx-auto">{children}</div>
33+
</Providers>
34+
</body>
1535
</html>
16-
)
36+
);
1737
}

0 commit comments

Comments
 (0)