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

feat: new version and design #68

Merged
merged 37 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
689802d
Update about section in English and Spanish translations
Michael-Liendo Jan 17, 2024
40707bb
Update user main design
Michael-Liendo Jan 17, 2024
5c2b1bf
Update main container padding
Michael-Liendo Jan 17, 2024
ff7413b
Refactor SocialMedia component
Michael-Liendo Jan 17, 2024
e5e4f6e
Add schema.org metadata to +page.svelte
Michael-Liendo Jan 17, 2024
99c2764
create a Bentogrids and create the design for the first item
Michael-Liendo Jan 17, 2024
3bed6c6
chore: add 2 item of the bento grid
Michael-Liendo Jan 17, 2024
20c683d
create the 3 item of the grid
Michael-Liendo Jan 17, 2024
f0624ae
Update styling for note cards
Michael-Liendo Jan 17, 2024
ff17606
Fix note links in +page.svelte
Michael-Liendo Jan 17, 2024
cae9766
Update SocialMedia and +page components
Michael-Liendo Jan 17, 2024
105c381
Add title attribute to dark mode button
Michael-Liendo Jan 17, 2024
1e67e2d
Update copyright year in footer
Michael-Liendo Jan 17, 2024
77764e3
Update note URLs in +page.svelte
Michael-Liendo Jan 18, 2024
2b0bb7f
Refactor page layout and metadata in notes component
Michael-Liendo Jan 18, 2024
1aee7b7
Update styling in +page and +page notes
Michael-Liendo Jan 18, 2024
32cf363
Remove unused imports and update meta tags in +page.svelte
Michael-Liendo Jan 18, 2024
dcea0f9
Update Header and Page styles
Michael-Liendo Jan 18, 2024
9c0b62c
Update background color in page links
Michael-Liendo Jan 18, 2024
8cc4722
Update font size and margin in homepage notes section
Michael-Liendo Jan 18, 2024
ca9a4fa
Update package.json version to 5.0.0
Michael-Liendo Jan 18, 2024
83a3d4f
Capacity on main route
Michael-Liendo Jan 18, 2024
3e84bf1
Refactor language selection links in Header.svelte and +page.svelte
Michael-Liendo Jan 19, 2024
07e1c44
Add Notion service and client code
Michael-Liendo Jan 19, 2024
703d402
Update import paths for Note types
Michael-Liendo Jan 19, 2024
c855ab6
Add type definitions for ProjectResponse and update project transformer
Michael-Liendo Jan 19, 2024
d6ee7f5
Refactor Entry and projects page components
Michael-Liendo Jan 19, 2024
6f0a8f6
Update layout styles in notes and projects pages
Michael-Liendo Jan 19, 2024
6e0ffe1
Refactor Entry component and note list layout
Michael-Liendo Jan 19, 2024
7bc3110
Update import statement in sitemap.xml server file
Michael-Liendo Jan 19, 2024
f77c060
Update sitemap routes
Michael-Liendo Jan 19, 2024
451a7e0
Update font size in homepage section
Michael-Liendo Jan 19, 2024
e57e331
Update language settings
Michael-Liendo Jan 19, 2024
5d72933
Update i18n-util imports and use baseLocale
Michael-Liendo Jan 19, 2024
965b056
Add new routes to sitemap.xml server file
Michael-Liendo Jan 19, 2024
15e5ffd
Refactor sitemap generation and add support for multiple languages
Michael-Liendo Jan 19, 2024
b22b362
Swap notesSlugsEn and notesSlugsEs in generateRoutes function
Michael-Liendo Jan 19, 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
3 changes: 3 additions & 0 deletions .typesafe-i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"baseLocale": "es"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "michaelliendo.com",
"version": "4.1.1",
"version": "5.0.0",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down
22 changes: 12 additions & 10 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div class="text-black dark:text-white" style="display: contents">%sveltekit.body%</div>
</body>
<html lang="%lang%">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div class="text-black dark:text-white" style="display: contents">
%sveltekit.body%
</div>
</body>
</html>
14 changes: 2 additions & 12 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { initAcceptLanguageHeaderDetector } from 'typesafe-i18n/detectors';

import { loadAllLocales } from '$i18n/i18n-util.sync';
import { detectLocale, i18n, isLocale } from '$i18n/i18n-util';
import { baseLocale, detectLocale, i18n, isLocale } from '$i18n/i18n-util';

import type { Handle, RequestEvent } from '@sveltejs/kit';
import type { Locales } from '$i18n/i18n-types';
Expand All @@ -13,18 +13,8 @@ export const handle: Handle = async ({ event, resolve }) => {
// read language slug
const [, lang] = event.url.pathname.split('/');

// redirect to base locale if no locale slug was found
if (!lang) {
const locale = getPreferredLocale(event);

return new Response(null, {
status: 302,
headers: { Location: `/${locale}` },
});
}

// if slug is not a locale, use base locale (e.g. api endpoints)
const locale = isLocale(lang) ? (lang as Locales) : getPreferredLocale(event);
const locale = isLocale(lang) ? (lang as Locales) : baseLocale;
const LL = L[locale];

// bind locale and translation functions to current request
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const en = {
PROJECTS: 'Projects',
},
FOOTER: {
COPYRIGHT: 'Made with ❤️ by Michael Liendo © {year:number}',
COPYRIGHT: 'Made with ❤️ by Michael Liendo © {startYear:number} - {year:number}',
},
},
HOMEPAGE: {
HI: `Hi I'm {name:string} {surname:string},`,
ABOUT: `I'm a Software Developer focused on Svelte and TypeScript with a passion for Web Development. I enjoy working on challenging projects and value collaboration and problem-solving.`,
ABOUT: `I'm a <strong>Software Developer</strong> focused on Svelte and TypeScript with a passion for Web Development. I enjoy working on challenging projects, value collaboration and problem-solving.`,
LATEST_NOTES: 'Latest Notes',
},
} satisfies BaseTranslation;
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/es/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ const es = {
PROJECTS: 'Proyectos',
},
FOOTER: {
COPYRIGHT: 'Hecho con ❤️ por Michael Liendo © {year:number}',
COPYRIGHT: 'Hecho con ❤️ por Michael Liendo © {startYear:number} - {year:number}',
},
},
HOMEPAGE: {
HI: 'Hola soy {name:string} {surname:string},',
ABOUT:
'Soy un Desarrollador de Software enfocado en Svelte y TypeScript apasionado por el Desarrollo Web. Disfruto trabajar en proyectos desafiantes y valoro la colaboración y la resolución de problemas.',
'Soy un <strong>Desarrollador de Software</strong> enfocado en Svelte y TypeScript apasionado por el Desarrollo Web. Disfruto trabajar en proyectos desafiantes, valoro la colaboración y la resolución de problemas.',
LATEST_NOTES: 'Últimas notas',
},
} satisfies BaseTranslation;
Expand Down
35 changes: 18 additions & 17 deletions src/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { BaseTranslation as BaseTranslationType, LocalizedString, RequiredParams } from 'typesafe-i18n'

export type BaseTranslation = BaseTranslationType
export type BaseLocale = 'en'
export type BaseLocale = 'es'

export type Locales =
| 'en'
Expand All @@ -17,39 +17,40 @@ type RootTranslation = {
LAYOUT: {
NAV: {
/**
* H​o​m​e
* I​n​i​c​i​o
*/
HOME: string
/**
* N​o​t​e​s
* N​o​t​a​s
*/
NOTES: string
/**
* P​r​o​j​e​c​t​s
* P​r​o​y​e​c​t​o​s
*/
PROJECTS: string
}
FOOTER: {
/**
* M​a​d​e​ ​w​i​t​h​ ​❤​️​ ​b​y​ ​M​i​c​h​a​e​l​ ​L​i​e​n​d​o​ ​©​ ​{​y​e​a​r​}
* H​e​c​h​o​ ​c​o​n​ ​❤​️​ ​p​o​r​ ​M​i​c​h​a​e​l​ ​L​i​e​n​d​o​ ​©​ ​{​s​t​a​r​t​Y​e​a​r​}​ ​-​ ​{​y​e​a​r​}
* @param {number} startYear
* @param {number} year
*/
COPYRIGHT: RequiredParams<'year'>
COPYRIGHT: RequiredParams<'startYear' | 'year'>
}
}
HOMEPAGE: {
/**
* H​i​ ​I​'​m​ ​{​n​a​m​e​}​ ​{​s​u​r​n​a​m​e​}​,
* H​o​l​a​ ​s​o​y​ ​{​n​a​m​e​}​ ​{​s​u​r​n​a​m​e​}​,
* @param {string} name
* @param {string} surname
*/
HI: RequiredParams<'name' | 'surname'>
/**
* I​'​m​ ​a​ ​S​o​f​t​w​a​r​e​ ​D​e​v​e​l​o​p​e​r​ ​f​o​c​u​s​e​d​ ​o​n​ ​S​v​e​l​t​e​ ​a​n​d​ ​T​y​p​e​S​c​r​i​p​t​ ​w​i​t​h​ ​a​ ​p​a​s​s​i​o​n​ ​f​o​r​ ​W​e​b​ ​D​e​v​e​l​o​p​m​e​n​t​.​ ​I​ ​e​n​j​o​y​ ​w​o​r​k​i​n​g​ ​o​n​ ​c​h​a​l​l​e​n​g​i​n​g​ ​p​r​o​j​e​c​t​s​ ​a​n​d​ ​v​a​l​u​e​ ​c​o​l​l​a​b​o​r​a​t​i​o​n​ ​a​n​d​ ​p​r​o​b​l​e​m​-​s​o​l​v​i​n​g​.
* S​o​y​ ​u​n​ ​<​s​t​r​o​n​g​>​D​e​s​a​r​r​o​l​l​a​d​o​r​ ​d​e​ ​S​o​f​t​w​a​r​e​<​/​s​t​r​o​n​g​>​ ​e​n​f​o​c​a​d​o​ ​e​n​ ​S​v​e​l​t​e​ ​y​ ​T​y​p​e​S​c​r​i​p​t​ ​a​p​a​s​i​o​n​a​d​o​ ​p​o​r​ ​e​l​ ​D​e​s​a​r​r​o​l​l​o​ ​W​e​b​.​ ​D​i​s​f​r​u​t​o​ ​t​r​a​b​a​j​a​r​ ​e​n​ ​p​r​o​y​e​c​t​o​s​ ​d​e​s​a​f​i​a​n​t​e​s​,​ ​v​a​l​o​r​o​ ​l​a​ ​c​o​l​a​b​o​r​a​c​i​ó​n​ ​y​ ​l​a​ ​r​e​s​o​l​u​c​i​ó​n​ ​d​e​ ​p​r​o​b​l​e​m​a​s​.
*/
ABOUT: string
/**
* L​a​t​e​s​t​ ​N​o​t​e​s
* Ú​l​t​i​m​a​s​ ​n​o​t​a​s
*/
LATEST_NOTES: string
}
Expand All @@ -59,36 +60,36 @@ export type TranslationFunctions = {
LAYOUT: {
NAV: {
/**
* Home
* Inicio
*/
HOME: () => LocalizedString
/**
* Notes
* Notas
*/
NOTES: () => LocalizedString
/**
* Projects
* Proyectos
*/
PROJECTS: () => LocalizedString
}
FOOTER: {
/**
* Made with ❤️ by Michael Liendo © {year}
* Hecho con ❤️ por Michael Liendo © {startYear} - {year}
*/
COPYRIGHT: (arg: { year: number }) => LocalizedString
COPYRIGHT: (arg: { startYear: number, year: number }) => LocalizedString
}
}
HOMEPAGE: {
/**
* Hi I'm {name} {surname},
* Hola soy {name} {surname},
*/
HI: (arg: { name: string, surname: string }) => LocalizedString
/**
* I'm a Software Developer focused on Svelte and TypeScript with a passion for Web Development. I enjoy working on challenging projects and value collaboration and problem-solving.
* Soy un <strong>Desarrollador de Software</strong> enfocado en Svelte y TypeScript apasionado por el Desarrollo Web. Disfruto trabajar en proyectos desafiantes, valoro la colaboración y la resolución de problemas.
*/
ABOUT: () => LocalizedString
/**
* Latest Notes
* Últimas notas
*/
LATEST_NOTES: () => LocalizedString
}
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/i18n-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { detectLocale as detectLocaleFn } from 'typesafe-i18n/detectors'
import { initExtendDictionary } from 'typesafe-i18n/utils'
import type { Formatters, Locales, Translations, TranslationFunctions } from './i18n-types'

export const baseLocale: Locales = 'en'
export const baseLocale: Locales = 'es'

export const locales: Locales[] = [
'en',
Expand Down
116 changes: 66 additions & 50 deletions src/lib/components/Entry.svelte
Original file line number Diff line number Diff line change
@@ -1,57 +1,73 @@
<script lang="ts">
import { page } from '$app/stores';
import type { MultiSelectEntity } from '$lib/utils/Notion/Notes/types';
import Calendar from '~icons/mdi/calendar-month';
import { page } from '$app/stores';
import { locale } from '$i18n/i18n-svelte';
import Calendar from '~icons/mdi/calendar-month';
import { baseLocale } from '$i18n/i18n-util';

export let title = '';
export let description = '';
export let publishDate: Date;
export let tags: MultiSelectEntity[] = [];
export let slug = '';
export let previewImageUrl: string | null = '';
import type { MultiSelectEntity } from '$lib/services/Notion/Notes/notes';

let formattedDate = new Date(publishDate).toLocaleDateString(`${$page.data.locale}-us`, {
month: 'long',
day: '2-digit',
year: 'numeric'
});
export let title = '';
export let description = '';
export let publishDate: Date;
export let tags: MultiSelectEntity[] = [];
export let slug = '';
export let previewImageUrl: string | null = '';

const baseLocaleUrl = $locale === baseLocale ? '' : `/${$locale}`;

let formattedDate = new Date(publishDate).toLocaleDateString(
`${$page.data.locale}-us`,
{
month: 'long',
day: '2-digit',
year: 'numeric',
}
);
</script>

<li class="mb-4 md:mb-0 last-of-type:mb-0">
<a href="/{$page.params.lang}/notes/{slug}">
<figure class="rounded overflow-hidden pb-4 flex justify-center items-center h-[150px]">
<img alt={title} src={previewImageUrl} width="350" height="100" />
</figure>
<header>
<h1 class="text-xl py-4 font-extrabold cursor-pointer hover:text-link hover:underline">
{title}
</h1>
</header>
<main class="pb-4">
<p>{description}</p>
</main>
<footer class="flex flex-col">
<div class="flex mb-2">
<span class="flex items-center mr-2">
<figure class="mr-2">
<Calendar class="text-gray-800 dark:text-white h-4 w-4" />
</figure>
<time class="text-sm mr-2" datetime={publishDate.toString()}>{formattedDate}</time>
</span>
</div>
<ul class="flex flex-wrap">
{#each tags as tag}
<li
class="text-sm mr-2 mb-2 bg-light-background dark:bg-dark-background rounded py-1 px-2"
>
<span
class="inline-block mr-1 rounded-full h-2 w-2"
style="background-color: {tag.color};"
/>
{tag.name}
</li>
{/each}
</ul>
</footer>
</a>
<a href="{baseLocaleUrl}/notes/{slug}">
<figure class="rounded-md mb-10 h-[200px]">
<img
alt={title}
class="rounded-md"
src={previewImageUrl}
width="350"
height="100"
/>
</figure>
<header>
<h1 class="text-xl font-extrabold hover:text-link hover:underline">
{title}
</h1>
</header>
<main class="pb-4">
<p>{description}</p>
</main>
<footer class="flex flex-col">
<div class="flex mb-2">
<span class="flex items-center mr-2">
<figure class="mr-2">
<Calendar class="text-gray-800 dark:text-white h-4 w-4" />
</figure>
<time class="text-sm mr-2" datetime={publishDate.toString()}
>{formattedDate}</time
>
</span>
</div>
<ul class="flex flex-wrap">
{#each tags as tag}
<li
class="text-sm mr-2 mb-2 bg-light-background dark:bg-dark-background rounded py-1 px-2"
>
<span
class="inline-block mr-1 rounded-full h-2 w-2"
style="background-color: {tag.color};"
/>
{tag.name}
</li>
{/each}
</ul>
</footer>
</a>
</li>
25 changes: 17 additions & 8 deletions src/lib/components/Footer.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
<script lang="ts">
import LL from '$i18n/i18n-svelte';
import LL from '$i18n/i18n-svelte';

const currentYear = new Date().getFullYear();
const currentYear = new Date().getFullYear();
</script>

<footer class="w-full px-4 flex items-center justify-center">
<div class="h-[70px] flex items-center justify-center">
<small>
{$LL.LAYOUT.FOOTER.COPYRIGHT({ year: currentYear })}
</small>
</div>
<footer class="w-full mt-5 px-4 py-5">
<div class=" flex items-center justify-center">
<small>
{$LL.LAYOUT.FOOTER.COPYRIGHT({ year: currentYear, startYear: 2021 })}
</small>
</div>
<div class="flex justify-center">
<small
><a
class="underline"
href="https://github.com/Michael-Liendo/michaelliendo.com"
>Source code</a
></small
>
</div>
</footer>
Loading