Skip to content

Commit

Permalink
*
Browse files Browse the repository at this point in the history
  • Loading branch information
imteekay committed Jun 22, 2024
1 parent 0acc3e8 commit a16315e
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Base/Article/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const Layout: FC<LayoutPropTypes> = ({
/>
</header>

{coverImage.src && (
{coverImage?.src && (
<CoverImage
src={coverImage.src}
width={coverImage.width}
Expand Down
15 changes: 15 additions & 0 deletions content/essay/on-losing-and-getting-better/en/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

What does losing feel like to you?

> “It's exciting because you have different ways to get better. There are certain things that you can figure out, that you can take advantage of, certain weaknesses that were exposed that you need to shore up. It sucks to lose, but at the same time, there are answers there. It’s exciting when you win, it’s exciting when you lose because the process should be exactly the same. You go back and you look and you find things that you could’ve done better.” — Kobe Bryant

I remember I was interviewed for a job and in my head I didn't perform well. I was not great. And that situation sucked. I lost all day thinking about that, how much of a loser I was. That experience hurt my confidence and my energy.

After one day I was reflecting about it and how I could reframe that experience. “Certain weaknesses were exposed”. What should I learn now? What are the knowledge gaps that I need to fill in? How can I be strategic to improve myself?

It's been hard but that's the way I always wanted to approach my life. Failure is there only if you give up. Winning and losing are part of the process. With this kind of mindset, you approach “win” and “lose” in the same way: Finding ways to get better.

In other words, you never lose.

---
6 changes: 6 additions & 0 deletions content/essay/on-losing-and-getting-better/en/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"title": "On losing and getting better",
"description": "Essay: On losing and getting better",
"date": "2024-06-22",
"tags": []
}
70 changes: 70 additions & 0 deletions pages/essays/[essay]/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import type { NextPage } from 'next';
import { GetStaticProps } from 'next';
import { ParsedUrlQuery } from 'querystring';

import { Layout } from 'Base/Article/Layout';
import { Head } from 'Base/components/Head';
import { Content, MDX, serializeMDX } from 'Base/components/MDX';
import {
getNestedPaths,
getNestedPostContent,
getNestedPostMetadata,
PostMetadata,
} from 'src/lib';

interface Params extends ParsedUrlQuery {
essay: string;
}

type PageProps = {
content: Content;
postMetadata: PostMetadata;
minutes: number;
};

const Page: NextPage<PageProps> = ({ content, postMetadata, minutes }) => (
<>
<Head
title={postMetadata.title}
description={postMetadata.description}
imageUrl={postMetadata.coverImage?.src}
/>
<Layout
tags={postMetadata.tags}
title={postMetadata.title}
date={postMetadata.date}
alternativeArticle={postMetadata.alternativeArticle}
showSocialLinks
minutes={minutes}
coverImage={postMetadata.coverImage}
>
<MDX content={content} />
</Layout>
</>
);

export async function getStaticPaths() {
return {
paths: getNestedPaths('essay'),
fallback: false,
};
}

export const getStaticProps: GetStaticProps<PageProps, Params> = async (
context,
) => {
const { essay } = context.params!;
const { postContent, minutes } = getNestedPostContent('essay', essay);
const postMetadata = getNestedPostMetadata('essay', essay);
const content = await serializeMDX(postContent);

return {
props: {
content,
postMetadata,
minutes,
},
};
};

export default Page;
1 change: 1 addition & 0 deletions src/lib/getPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const folderMapper = {
tags: 'tag',
microblog: 'microblog',
notes: 'notes',
essay: 'essay',
};

type FolderTypes = keyof typeof folderMapper;
Expand Down

0 comments on commit a16315e

Please sign in to comment.