Skip to content

Commit

Permalink
Improve routes
Browse files Browse the repository at this point in the history
  • Loading branch information
cesalberca committed Aug 26, 2024
1 parent b68c142 commit 86fd028
Show file tree
Hide file tree
Showing 24 changed files with 14 additions and 14 deletions.
Binary file removed public/assets/images/articles/marbles.jpg
Binary file not shown.
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion src/app/blog/(posts)/angular-jest/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const metadata = {
slug: 'angular-jest',
title: 'Jest Angular',
date: '2019-11-03',
image: 'desert.jpg',
image: 'angular-jest/desert.jpg',
categories: ['angular', 'testing'],
readTime: 8,
summary:
Expand Down
4 changes: 2 additions & 2 deletions src/app/blog/(posts)/blog-redesign/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { AccentList } from '@/core/components/accent-list/accent-list'
export const metadata = {
slug: 'blog-redesign',
title: 'Blog Redesign',
date: '2024-08-23',
date: '2024-08-26',
image: 'blog-redesign/medusa.jpg',
categories: ['software-development', 'branding', 'design'],
readTime: 10,
Expand Down Expand Up @@ -82,7 +82,7 @@ What I decided to focus on instead was creating a clean design with a big focus
<div className="p-xl">Background (more hover!)</div>
</Background></div>

<div><Background image="/assets/images/articles/blog-redesign/medusa.jpg">
<div><Background image="/assets/images/posts/blog-redesign/medusa.jpg">
<div className="p-xl">Background with image (still hover!)</div>
</Background></div>

Expand Down
12 changes: 6 additions & 6 deletions src/app/blog/(posts)/migrating-to-typescript/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const metadata = {
title: 'Migrating to TypeScript',
date: '2019-11-19',
categories: ['typescript', 'software-development'],
image: 'rainbow.jpeg',
image: 'migrating-to-typescript/rainbow.jpeg',
summary:
"In this tutorial we will see how to migrate a codebase from JavaScript to TypeScript. We will migrate the code of my talk Advanced JavaScript Pattern. Let's start!",
}
Expand Down Expand Up @@ -54,13 +54,13 @@ Now we install TypeScript as a `dev-dependency`: `npm i typescript -DE`. We add

Because we don't have any `.ts` file that we can compile we'll see that the compilation is successful:

![image-20191112213355655](/assets/images/articles/migrating-to-typescript/image-20191112213355655.png)
![image-20191112213355655](/assets/images/posts/migrating-to-typescript/image-20191112213355655.png)

## Migration

Let's try change the extension from `.js` to `.ts` and compile again:

![image-20191112213602568](/assets/images/articles/migrating-to-typescript/image-20191112213602568.png)
![image-20191112213602568](/assets/images/posts/migrating-to-typescript/image-20191112213602568.png)

What?! It compiles correctly! Well yes, **any JavaScript file is valid TypeScript code**.

Expand Down Expand Up @@ -347,7 +347,7 @@ const bar = createSafe(1) // bar is inferred as a number

Yet if we compile we'll see that we get the following error:

![image-20191113201553918](/assets/images/articles/migrating-to-typescript/image-20191113201553918.png)
![image-20191113201553918](/assets/images/posts/migrating-to-typescript/image-20191113201553918.png)

What happened? Well, given that any type can be set to `Target` that raises a problem, as we only want `Target` to take any type that is of an object kind. So what we want here is [to constrain the type](https://www.typescriptlang.org/docs/handbook/generics.html#generic-constraints) that we can assign to `Target` to the `object` type:

Expand Down Expand Up @@ -399,7 +399,7 @@ Let's run the tests:
npm test
```

![image-20191113202705616](/assets/images/articles/migrating-to-typescript/image-20191113202705616.png)
![image-20191113202705616](/assets/images/posts/migrating-to-typescript/image-20191113202705616.png)

Oups, what is happening? Well, [Jest](https://jestjs.io/), the test runner that we are using, doesn't know how to compile TypeScript, which requires some configuration. We add [Babel](https://babeljs.io/) so it can erase the types and then run the tests:

Expand Down Expand Up @@ -427,7 +427,7 @@ module.exports = {

And we run the tests!

![image-20191115194956149](/assets/images/articles/migrating-to-typescript/image-20191115194956149.png)
![image-20191115194956149](/assets/images/posts/migrating-to-typescript/image-20191115194956149.png)

## Conclusion

Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/(posts)/theming/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const metadata = {
readTime: 8,
date: '2019-06-06',
categories: ['css', 'software-development'],
image: 'art-artistic-canvas.jpg',
image: 'theming/art-artistic-canvas.jpg',
summary: 'Theming a web with custom properties is as easy as it gets as shown in this article.',
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/(posts)/use-cases-and-commands/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const metadata = {
date: '2019-04-17',
readTime: 7,
categories: ['design-patterns', 'software-architecture'],
image: 'abstract-dark-design.jpg',
image: 'use-cases-and-commands/abstract-dark-design.jpg',
summary:
'Use cases are the heart of our application, they are the actions that our users can perform. The command pattern helps us encapsulate requests.',
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/posts/delivery/post-excerpt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const PostExcerpt: FC<{ post: PostMetadata }> = ({ post }) => (
<Link href={`/blog/${post.slug}`}>
<AccentCard className="break-inside-avoid mb-4">
<Image
src={`/assets/images/articles/${post.image}`}
src={`/assets/images/posts/${post.image}`}
alt={post.title}
width={200}
height={200}
Expand Down
4 changes: 2 additions & 2 deletions src/features/posts/delivery/post.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const PostPage: FC<PropsWithChildren<{ metadata: PostMetadata; slug: stri
}),
}}
/>
<Background className="w-full h-[60vh]" image={`/assets/images/articles/${metadata.image}`}>
<Background className="w-full h-[60vh]" image={`/assets/images/posts/${metadata.image}`}>
<div className="p-xl">
<header className="flex gap-xxs">
<small>{Datetime.fromIso(metadata.date).format()}</small>
Expand All @@ -54,7 +54,7 @@ export const PostPage: FC<PropsWithChildren<{ metadata: PostMetadata; slug: stri
key={category}
type="invisible"
to={`/blog/category/${category}`}
className={cn(badgeVariants({ variant: 'outline' }), 'p-0')}
className={cn(badgeVariants({ variant: 'outline' }), 'p-0 h-min')}
>
<Badge>{category}</Badge>
</Link>
Expand Down

0 comments on commit 86fd028

Please sign in to comment.