Skip to content

Commit f8bf594

Browse files
committed
feat: add blog section
1 parent b3d3120 commit f8bf594

File tree

6 files changed

+193
-2
lines changed

6 files changed

+193
-2
lines changed

app/_components/authors.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { getDictionary } from '@app/_dictionaries/get-dictionary'
2+
import type { Locale } from '@app/_dictionaries/i18n-config'
3+
import type { FC } from 'react'
4+
import { LinkCustom } from './link-custom'
5+
6+
type TopContentProps = {
7+
title: string
8+
date: string
9+
authors: {
10+
name: string
11+
link: string
12+
}[]
13+
lang: Locale
14+
}
15+
16+
export const TopContent: FC<TopContentProps> = async ({
17+
title,
18+
date,
19+
authors,
20+
lang
21+
}) => {
22+
23+
const dictionary = await getDictionary(lang)
24+
const dateObj = new Date(date)
25+
26+
return (
27+
<>
28+
<h1>{title}</h1>
29+
<div className="mt-8 mb-16 text-sm text-gray-400">
30+
<time dateTime={dateObj.toISOString()}>
31+
{dateObj.toLocaleDateString(lang, {
32+
month: 'long',
33+
day: 'numeric',
34+
year: 'numeric'
35+
})}
36+
</time>{' '}
37+
{dictionary.by}{' '}
38+
{authors.map(author => (
39+
<span key={author.name} className="not-last:after:content-[',_']">
40+
<LinkCustom href={author.link} className="text-gray-800 dark:text-gray-100">
41+
{author.name}
42+
</LinkCustom>
43+
</span>
44+
))}
45+
</div>
46+
</>
47+
)
48+
}

app/_components/blog.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import type { MdxFile } from 'nextra';
2+
import { Link } from 'nextra-theme-docs';
3+
import { getPageMap } from 'nextra/page-map';
4+
import type { FC } from 'react';
5+
6+
export async function generateMetadata() {
7+
return {
8+
title: "Blog",
9+
description: "Blog",
10+
};
11+
}
12+
13+
export const Blog: FC<{ lang: string }> = async ({ lang }) => {
14+
const pageMap = (await getPageMap(`/${lang}/blog`)) as unknown as MdxFile[]
15+
16+
return pageMap.map(page => {
17+
if (page.name === 'index') return
18+
19+
const { title, description, date } = page.frontMatter!
20+
21+
return (
22+
<div key={page.route} className="mt-12">
23+
<h3 className="text-2xl font-semibold">
24+
<Link href={page.route} className="after:content-['_→']">
25+
{title}
26+
</Link>
27+
</h3>
28+
<p className="my-6 leading-7 opacity-80">
29+
{description}
30+
</p>
31+
<time
32+
dateTime={new Date(date).toISOString()}
33+
className="text-sm opacity-50"
34+
>
35+
{new Date(date).toLocaleDateString(lang, {
36+
month: 'long',
37+
day: 'numeric',
38+
year: 'numeric'
39+
})}
40+
</time>
41+
</div>
42+
)
43+
})
44+
}

app/_constants/footer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ export const FOOTER_MENU_LINKS = (lang: string) => [
88
label: 'Documentation'
99
},
1010
{
11-
path: `/${lang}/about/about`,
11+
path: '/blog',
12+
label: 'Blog'
13+
},
14+
{
15+
path: `/about`,
1216
label: 'About'
13-
}
17+
},
1418
]

content/en/_meta.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ export default {
1010
type: 'page',
1111
title: 'Documentation'
1212
},
13+
blog: {
14+
type: 'page',
15+
title: 'Blog',
16+
theme: {
17+
sidebar: false,
18+
typesetting: 'article'
19+
}
20+
},
1321
about: {
1422
type: 'page',
1523
title: 'About',

content/en/blog.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
searchable: false
3+
---
4+
5+
import { Blog } from "@app/_components/blog";
6+
7+
# Blog
8+
9+
<Blog lang={props.params.lang} />
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: Launching "UX Patterns for Devs"
3+
image: https://assets.vercel.com/image/upload/v1630059453/swr/v1.png
4+
description: "Introducing today my new open-source resource filled with proven UX patterns, practical code snippets, and actionable tips - empowering developers to build more accessible and user-friendly interfaces."
5+
date: 2024-12-11
6+
authors:
7+
- name: David Dias
8+
link: https://x.com/thedaviddias
9+
---
10+
11+
import { TopContent } from "@app/_components/authors";
12+
13+
<TopContent lang={props.params.lang} {...metadata} />
14+
15+
![Screenshot of the text UX Patterns for Devs](../../../public/img/opengraph-image.png)
16+
17+
For over 15 years, I've worked alongside web and UX designers to refine user experiences.
18+
19+
I'm introducing today my new open-source resource filled with proven UX patterns, practical code snippets, and actionable tips - empowering developers to build more accessible and user-friendly interfaces.
20+
21+
For the incoming weeks, I will be adding new patterns to the collection and try to be as consistent as possible. This will be a continuous process without any specific deadline.
22+
23+
## Why "UX Patterns for Developers"?
24+
25+
I've been using the term "UX Patterns" for a long time now. In discussions with other developers or colleagues because for me, defining the actually UX patterns helps in the creation of UI components.
26+
27+
I've encountered many people jumping in creating a component without fully understanding the UX pattern behind it. I've also seen many developers creating components that are not UX patterns, but rather a singular vision of a UI component. This creates a lot of risks.
28+
29+
With "UX Patterns for Developers", I'm trying to create a resource that will help developers understand the UX patterns behind UI components and take into all aspects of creating new components - SEO, Accessibility, Usability, Performance, and more.
30+
31+
## How to use "UX Patterns for Developers"?
32+
33+
To this day, the collection is divided into two main sections:
34+
35+
- Layout & Navigation
36+
- Inputs & Forms
37+
- Content Management
38+
- User Feedback
39+
40+
This will certainly change in the future, but for now, it's a good starting point.
41+
42+
Each section contains a set of UX patterns that can be used to build UI components. Each pattern is divided into three main sections:
43+
44+
1. **Overview** - Introduction and use cases for the pattern
45+
2. **Use Cases** - Real-world examples and scenarios where the pattern should be implemented
46+
3. **Benefits** - Key advantages and value propositions of using this pattern
47+
4. **Anatomy** - Detailed breakdown of the component's structure
48+
5. **Best Practices** - Guidelines for implementation, including do's and don'ts
49+
6. **Code Examples** - Code examples and technical considerations
50+
7. **Accessibility** - Guidelines for accessibility considerations
51+
8. **SEO** - Search engine optimization considerations and best practices
52+
9. **Browser Support** - Information on browser support for the pattern
53+
10. **Testing** - Guidelines for unit, integration, and accessibility testing
54+
11. **Resources** - Additional documentation, articles, libraries...
55+
56+
Each pattern also contains a set of resources, including articles and libraries.
57+
58+
## How to contribute?
59+
60+
We welcome contributions from the community! Whether you want to:
61+
62+
- Add new patterns
63+
- Improve existing documentation
64+
- Fix bugs
65+
- Suggest improvements
66+
67+
Visit our [GitHub repository](https://github.com/thedaviddias/ux-patterns-for-developers/blob/main/.github/CONTRIBUTING) to learn how to contribute.
68+
69+
## What's Next
70+
71+
This is just the beginning! With time and a lot of work and contributions, I hope to make it a valuable resource for developers looking to improve their UI design and UX.
72+
73+
If you have any feedback about the project or the future of the collection, please
74+
[let us know](https://github.com/thedaviddias/ux-patterns-for-developers/discussions).
75+
76+
## Thank You!
77+
78+
Special thanks to every member of the community who has been supporting this project and everyone who helped and gave me feedback on this project!

0 commit comments

Comments
 (0)