Skip to content

Commit 703edc9

Browse files
committed
fix: dark mode and improve cards
1 parent 32f988a commit 703edc9

File tree

9 files changed

+269
-196
lines changed

9 files changed

+269
-196
lines changed

app/_components/footer.tsx

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,26 @@ import { getDictionary } from '../_dictionaries/get-dictionary';
77
import { LinkCustom } from './link-custom';
88
import { SOCIAL_LINKS } from './social';
99

10-
const FooterMenuLinks = ({ lang }: { lang: string }) => {
11-
return (
12-
<div>
13-
<h3 className="small-title">General</h3>
14-
<ul className="mt-3 space-y-1">
15-
{FOOTER_MENU_LINKS(lang).map(({ path, label }) => (
16-
<li key={label}>
17-
<LinkCustom href={path} className="dark:!text-white">
18-
{label}
19-
</LinkCustom>
20-
</li>
21-
))}
22-
</ul>
23-
</div>
24-
)
10+
type FooterLinksProps = {
11+
title: string;
12+
links: Array<{
13+
label: string;
14+
path?: string;
15+
shortlink?: string;
16+
}>;
2517
}
2618

27-
const FooterSocialLinks = () => {
19+
const FooterLinks = ({ title, links }: FooterLinksProps) => {
2820
return (
2921
<div>
30-
<h3 className="small-title">Social</h3>
22+
<h3 className="small-title">{title}</h3>
3123
<ul className="mt-3 space-y-1">
32-
{SOCIAL_LINKS.map(({ label, shortlink }) => (
24+
{links.map(({ label, path, shortlink }) => (
3325
<li key={label}>
34-
<LinkCustom href={shortlink} className="dark:!text-white">
26+
<LinkCustom
27+
href={path || shortlink || '#'}
28+
className="text-gray-500 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white transition-colors text-sm"
29+
>
3530
{label}
3631
</LinkCustom>
3732
</li>
@@ -41,6 +36,20 @@ const FooterSocialLinks = () => {
4136
)
4237
}
4338

39+
const FooterMenuLinks = ({ lang }: { lang: string }) => (
40+
<FooterLinks
41+
title="General"
42+
links={FOOTER_MENU_LINKS(lang)}
43+
/>
44+
)
45+
46+
const FooterSocialLinks = () => (
47+
<FooterLinks
48+
title="Social"
49+
links={SOCIAL_LINKS}
50+
/>
51+
)
52+
4453
export const Footer = async ({ lang }: { lang: string }) => {
4554
const dictionary = await getDictionary(lang)
4655

@@ -55,7 +64,7 @@ export const Footer = async ({ lang }: { lang: string }) => {
5564
</h2>
5665
<div className="mx-auto max-w-5xl px-2 py-12 sm:px-6 lg:px-8 lg:py-7">
5766
<div className="flex flex-col-reverse sm:flex-row print:hidden">
58-
<div className="w-full flex-grow text-left sm:mb-0 sm:w-1/2 md:pr-24 lg:w-[40%]">
67+
<div className="w-full flex-grow text-left sm:mb-0 sm:w-1/2 md:pr-24 lg:w-[20%]">
5968
<span className="mb-5 block text-xl font-bold">{dictionary.name}</span>
6069
<p
6170
className="text-sm text-gray-500 dark:text-gray-400">
@@ -64,17 +73,17 @@ export const Footer = async ({ lang }: { lang: string }) => {
6473
<div className="flex space-x-6"></div>
6574
</div>
6675

67-
<div className="flex w-full !max-w-full flex-shrink-0 flex-grow justify-between text-gray-500 sm:w-1/2 lg:w-[40%] dark:text-gray-400">
76+
<div className="flex w-full !max-w-full flex-shrink-0 flex-grow justify-between text-gray-500 sm:w-1/2 lg:w-[30%] dark:text-gray-400">
6877
<FooterMenuLinks lang={lang} />
6978
<FooterSocialLinks />
7079
</div>
7180
</div>
72-
<div className="mt-8 flex items-start flex-col border-t border-gray-200 pt-3 dark:border-gray-400">
81+
<div className="mt-8 flex items-center flex-col border-t border-gray-200 pt-3 dark:border-gray-400 text-sm">
7382
<p className="text-gray-500">
7483
&copy; {new Date().getFullYear()} UX Patterns for Devs
7584
</p>
7685
<p className="text-gray-500">
77-
Made with ❤️ by <a href="https://thedaviddias.com" target="_blank" rel="noopener noreferrer" className="font-bold underline">David Dias</a> for the Open-Source Community.
86+
Made with ❤️ by <a href="https://ddias.link/blog" target="_blank" rel="noopener noreferrer" className="font-bold underline">David Dias</a> for the Open-Source Community.
7887
</p>
7988
</div>
8089
</div>

app/_components/sections/overview-grid.tsx

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
1+
import { cn } from '@/app/_utils/cn'
22
import { getPatterns } from '@app/_utils/get-patterns'
3-
import Link from 'next/link'
3+
import { LinkCustom } from '../link-custom'
44
import { Badge } from '../ui/badge'
55

66
type Pattern = {
@@ -22,21 +22,7 @@ export const OverviewGrid = async ({ lang }: { lang: string }) => {
2222
</h2>
2323
<div className="grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3">
2424
{category.patterns.map((pattern) => (
25-
<div
26-
key={pattern.title}
27-
className={`group relative rounded-xl border border-neutral-200 dark:border-neutral-800 ${!pattern.comingSoon
28-
? 'hover:scale-105 transition-transform ease-in-out duration-100'
29-
: 'opacity-75'
30-
}`}
31-
>
32-
{pattern.href ? (
33-
<Link href={pattern.href}>
34-
<PatternContent pattern={pattern} />
35-
</Link>
36-
) : (
37-
<PatternContent pattern={pattern} />
38-
)}
39-
</div>
25+
<PatternWrapper key={pattern.title} pattern={pattern} />
4026
))}
4127
</div>
4228
</div>
@@ -45,8 +31,34 @@ export const OverviewGrid = async ({ lang }: { lang: string }) => {
4531
)
4632
}
4733

34+
const PatternWrapper = ({ pattern }: { pattern: Pattern }) => {
35+
const wrapperClasses = cn(
36+
"relative rounded-xl border border-neutral-200 dark:border-neutral-800",
37+
!pattern.comingSoon && "hover:border-neutral-400 dark:hover:border-neutral-600 hover:scale-105 transition-all duration-100 ease-in-out"
38+
)
39+
40+
const content = <PatternContent pattern={pattern} />
41+
42+
return (
43+
<div className={wrapperClasses}>
44+
{pattern.href ? (
45+
<LinkCustom
46+
href={pattern.href}
47+
className="!no-underline"
48+
icon={false}
49+
>
50+
{content}
51+
</LinkCustom>
52+
) : content}
53+
</div>
54+
)
55+
}
56+
4857
const PatternContent = ({ pattern }: { pattern: Pattern }) => (
49-
<div className="relative overflow-hidden rounded-xl p-5">
58+
<div className={cn(
59+
"relative overflow-hidden rounded-xl p-5 transition-all duration-300",
60+
!pattern.comingSoon ? "hover:animate-card-hover cursor-pointer" : "opacity-75 cursor-not-allowed"
61+
)}>
5062
<div className="flex items-center justify-between">
5163
<h3 className="font-display text-xl font-semibold text-foreground">
5264
{pattern.title}

app/_components/social.tsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,26 @@ export const SOCIAL_LINKS: SocialLink[] = [
4747
),
4848
},
4949
{
50-
label: 'Github',
51-
link: 'https://github.com/thedaviddias',
52-
shortlink: 'https://ddias.link/github',
53-
rel: 'me',
50+
label: 'Discord',
51+
link: 'https://discord.gg/EG6tmxsESP',
52+
shortlink: 'https://ddias.link/discord',
5453
icon: (
5554
<SimpleIconComponent
56-
icon={siGithub}
55+
icon={siDiscord}
5756
className="w-10 h-10 p-1.5 border rounded-full transition-colors duration-200 hover:bg-gray-100 dark:hover:bg-gray-800 border-gray-200 dark:border-gray-700"
5857
/>
5958
),
6059
},
6160
{
62-
label: 'Join my Discord',
63-
link: 'https://discord.gg/EG6tmxsESP',
64-
shortlink: 'https://ddias.link/discord',
61+
label: 'Github',
62+
link: 'https://github.com/thedaviddias',
63+
shortlink: 'https://ddias.link/github',
64+
rel: 'me',
6565
icon: (
6666
<SimpleIconComponent
67-
icon={siDiscord}
67+
icon={siGithub}
6868
className="w-10 h-10 p-1.5 border rounded-full transition-colors duration-200 hover:bg-gray-100 dark:hover:bg-gray-800 border-gray-200 dark:border-gray-700"
6969
/>
7070
),
7171
},
72-
{
73-
label: 'Newsletter',
74-
link: 'https://thedaviddias.substack.com',
75-
shortlink: 'https://ddias.link/newsletter',
76-
rel: 'me',
77-
},
7872
]

app/_constants/patterns.ts

Lines changed: 12 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import { contentManagementPatterns } from './patterns/content-management'
2+
import { formPatterns } from './patterns/forms'
3+
import { navigationPatterns } from './patterns/navigation'
4+
import { userFeedbackPatterns } from './patterns/user-feedback'
5+
16
export const PATTERNS_MAP = {
27
navigation: {
38
name: 'Layout & Navigation',
@@ -17,147 +22,16 @@ export const PATTERNS_MAP = {
1722
}
1823
} as const
1924

25+
26+
2027
export const PATTERNS = {
21-
'Layout & Navigation': [
22-
{
23-
title: 'Breadcrumb',
24-
description: 'Help users understand their current location',
25-
href: '/docs/navigation/breadcrumb'
26-
},
27-
{
28-
title: 'Pagination',
29-
description: 'Navigate through multiple pages of content',
30-
},
31-
{
32-
title: 'Navigation Menu',
33-
description: 'Organize and structure site navigation',
34-
}
35-
],
36-
'Content Management': [
37-
{
38-
title: 'Accordion',
39-
description: 'Expand and collapse content sections',
40-
},
41-
{
42-
title: 'Carousel',
43-
description: 'Display multiple items in a rotating view',
44-
},
45-
{
46-
title: 'Drag and Drop',
47-
description: 'Allow users to reorder items intuitively',
48-
},
49-
{
50-
title: 'Modal',
51-
description: 'Display focused content or actions',
52-
},
53-
{
54-
title: 'Tooltip',
55-
description: 'Provide additional context on hover',
56-
}
57-
],
58-
'User Feedback': [
59-
{
60-
title: 'Empty States',
61-
description: 'Guide users when no content is available',
62-
},
63-
{
64-
title: 'Loading Indicator',
65-
description: 'Show users that content is being loaded',
66-
},
67-
{
68-
title: 'Notification',
69-
description: 'Inform users about important updates',
70-
},
71-
{
72-
title: 'Progress Indicator',
73-
description: 'Show completion status of an operation',
74-
}
75-
],
76-
'Input & Forms': [
77-
{
78-
title: 'Button',
79-
description: 'Trigger actions and submit forms',
80-
href: '/docs/forms/button'
81-
},
82-
{
83-
title: 'Checkbox',
84-
description: 'Allow users to select multiple options',
85-
},
86-
{
87-
title: 'Code Confirmation',
88-
description: 'Verify codes with segmented input',
89-
},
90-
{
91-
title: 'Color Picker',
92-
description: 'Select colors with visual feedback',
93-
},
94-
{
95-
title: 'Currency Input',
96-
description: 'Enter and format monetary values',
97-
},
98-
{
99-
title: 'Date Input',
100-
description: 'Enter dates in a structured format',
101-
},
102-
{
103-
title: 'Date Picker',
104-
description: 'Select dates from a calendar interface',
105-
},
106-
{
107-
title: 'Date Range',
108-
description: 'Select a range between two dates',
109-
},
110-
{
111-
title: 'File Input',
112-
description: 'Upload and handle files',
113-
},
114-
{
115-
title: 'Form Validation',
116-
description: 'Validate and provide feedback',
117-
},
118-
{
119-
title: 'Multi-select Input',
120-
description: 'Choose multiple items from a list',
121-
},
122-
{
123-
title: 'Password',
124-
description: 'Secure password entry with feedback',
125-
},
126-
{
127-
title: 'Phone Number',
128-
description: 'Format and validate phone numbers',
129-
},
130-
{
131-
title: 'Radio',
132-
description: 'Select a single option from a group',
133-
},
134-
{
135-
title: 'Search Field',
136-
description: 'Search through content efficiently',
137-
},
138-
{
139-
title: 'Selection Input',
140-
description: 'Choose from predefined options',
141-
},
142-
{
143-
title: 'Slider',
144-
description: 'Select values from a range',
145-
},
146-
{
147-
title: 'Text Field',
148-
description: 'Enter and edit text content',
149-
},
150-
{
151-
title: 'Time Input',
152-
description: 'Enter time in a structured format',
153-
},
154-
{
155-
title: 'Toggle',
156-
description: 'Switch between two states',
157-
}
158-
]
28+
'Layout & Navigation': navigationPatterns,
29+
'Content Management': contentManagementPatterns,
30+
'User Feedback': userFeedbackPatterns,
31+
'Input & Forms': formPatterns
15932
} as const
16033

34+
16135
export type Pattern = {
16236
title: string
16337
description: string
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export const contentManagementPatterns = [
2+
{
3+
title: 'Accordion',
4+
description: 'Expand and collapse content sections',
5+
},
6+
{
7+
title: 'Carousel',
8+
description: 'Display multiple items in a rotating view',
9+
},
10+
{
11+
title: 'Drag and Drop',
12+
description: 'Allow users to reorder items intuitively',
13+
},
14+
{
15+
title: 'Modal',
16+
description: 'Display focused content or actions',
17+
},
18+
{
19+
title: 'Tooltip',
20+
description: 'Provide additional context on hover',
21+
}
22+
] as const

0 commit comments

Comments
 (0)