Skip to content

Commit fb8afa4

Browse files
committed
feat: enhance UI components with improved animations, styles, and accessibility features
1 parent 659777b commit fb8afa4

7 files changed

Lines changed: 88 additions & 21 deletions

File tree

src/app/blog/[...slug]/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ function Header({
123123
<div className="space-y-3">
124124
<div className="text-muted-foreground flex flex-row items-center gap-1 font-mono text-xs font-normal md:text-sm">
125125
<time>{formattedDate}</time>
126-
<div className="flex flex-row items-center gap-1">
126+
{/* <div className="flex flex-row items-center gap-1">
127127
<span>-</span>
128128
<span className="text-muted-foreground">{author}</span>
129-
</div>
129+
</div> */}
130130
<Separator orientation="vertical" className="bg-border mx-2 h-5" />
131131
<span className="text-primary text-xs font-normal md:text-sm">
132132
{category}
@@ -141,7 +141,7 @@ function Header({
141141
)}
142142
</div>
143143
</div>
144-
<Separator className="bg-border my-10 w-20" />
144+
<Separator className="my-10 w-20 bg-transparent" />
145145
</div>
146146
)
147147
}

src/components/hero.tsx

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,33 @@ import { motion, type Variants } from "framer-motion"
66
const titleVariants: Variants = {
77
visible: {
88
opacity: 1,
9+
filter: "blur(0px)",
910
transition: {
1011
ease: "easeOut" as const,
1112
duration: 0.7
1213
}
1314
},
1415
hidden: {
15-
opacity: 0
16+
opacity: 0,
17+
filter: "blur(8px)"
1618
}
1719
}
1820

1921
const elVariants: Variants = {
2022
visible: (i: number) => ({
2123
opacity: 1,
2224
y: 0,
25+
filter: "blur(0px)",
2326
transition: {
2427
ease: "easeOut" as const,
25-
delay: i * 0.3,
28+
delay: i * 0.2,
2629
duration: 0.3
2730
}
2831
}),
2932
hidden: {
3033
opacity: 0,
31-
y: 10
34+
y: 10,
35+
filter: "blur(4px)"
3236
}
3337
}
3438

@@ -43,16 +47,28 @@ const Hero = () => {
4347
>
4448
Hola, soy Daniel Castillejo
4549
</motion.h1>
46-
<div className="text-muted-foreground flex flex-col gap-2 pt-4 text-base">
47-
<p className="text-pretty sm:text-balance">
50+
<motion.div className="text-secondary-foreground flex flex-col gap-2 pt-4 text-base sm:text-lg">
51+
<motion.p
52+
initial="hidden"
53+
animate="visible"
54+
custom={1}
55+
variants={elVariants}
56+
className="text-pretty sm:text-balance"
57+
>
4858
Soy un ingeniero de software con más de 15 años de experiencia basado
4959
en México. Actualmente me desempeño como Arquitecto de Soluciones en
5060
la industria automotriz implementando aplicaciones full-stack.
51-
</p>
52-
<p className="text-pretty sm:text-balance">
61+
</motion.p>
62+
<motion.p
63+
initial="hidden"
64+
animate="visible"
65+
custom={2}
66+
variants={elVariants}
67+
className="text-pretty sm:text-balance"
68+
>
5369
Soy entusiasta del diseño, amante de la música y guitarrista promedio.
54-
</p>
55-
</div>
70+
</motion.p>
71+
</motion.div>
5672
</>
5773
)
5874
}

src/components/main-nav.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ const MainNav = () => {
4545
return (
4646
<div className="relative z-10 h-20 max-h-20 sm:h-full">
4747
<GradientBlur className="fixed inset-0 h-20 rotate-180 sm:hidden" />
48+
<div
49+
aria-hidden="true"
50+
className="from-background fixed inset-x-0 top-0 z-[15] h-20 bg-gradient-to-b to-transparent sm:hidden"
51+
/>
4852
<div className="transition-disabled fixed z-20 w-full px-6 sm:w-[100px] sm:px-0">
4953
<div className="flex grow flex-row items-center justify-between gap-10 py-4 sm:h-screen sm:flex-col sm:justify-start sm:gap-20">
5054
<header>
@@ -59,7 +63,7 @@ const MainNav = () => {
5963
{/* <span className="hidden font-semibold sm:inline">dkast.dev</span> */}
6064
</Link>
6165
</header>
62-
<nav className="flex flex-row gap-2 rounded-full bg-white p-1 py-1 shadow sm:flex-col">
66+
<nav className="flex flex-row gap-2 rounded-full bg-white/50 p-1 py-1 shadow inset-ring inset-ring-white/60 backdrop-blur sm:flex-col">
6367
{navItems &&
6468
navItems.map((navItem, index) => {
6569
const selected =

src/components/mdx.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,35 @@ interface MdxProps {
66
code: string
77
}
88

9+
function MdxCode({
10+
children,
11+
className,
12+
...rest
13+
}: React.HTMLAttributes<HTMLElement>) {
14+
// Code blocks (inside <pre>) receive a data-language attribute from rehype-pretty-code
15+
if ("data-language" in rest) {
16+
return (
17+
<code className={className} {...rest}>
18+
{children}
19+
</code>
20+
)
21+
}
22+
23+
return (
24+
<code
25+
className={[
26+
"text-primary rounded-sm bg-white px-1.5 py-1 font-mono text-[0.85em] font-normal inset-ring inset-ring-black/10 before:content-none after:content-none dark:bg-gray-800",
27+
className
28+
]
29+
.filter(Boolean)
30+
.join(" ")}
31+
{...rest}
32+
>
33+
{children}
34+
</code>
35+
)
36+
}
37+
938
function MdxImage(
1039
props: DetailedHTMLProps<
1140
ImgHTMLAttributes<HTMLImageElement>,
@@ -42,8 +71,8 @@ function MdxImage(
4271

4372
const Mdx = ({ code }: MdxProps) => {
4473
return (
45-
<div className="prose prose-neutral lg:prose lg:prose-neutral prose-headings:font-display prose-headings:font-normal prose-headings:text-muted-foreground prose-h2:text-xl prose-a:decoration-primary prose-pre:-mx-6 prose-pre:overflow-x-auto prose-pre:rounded-none prose-pre:bg-gray-800 md:prose-pre:mx-0 md:prose-pre:rounded-lg max-w-none sm:px-0">
46-
<MDXContent code={code} components={{ img: MdxImage }} />
74+
<div className="prose prose-neutral prose-headings:font-display prose-headings:font-normal prose-headings:text-secondary-foreground prose-h2:text-xl prose-a:decoration-primary prose-pre:-mx-6 prose-pre:overflow-x-auto prose-pre:rounded-none prose-pre:bg-gray-800 md:prose-pre:mx-0 md:prose-pre:rounded-lg max-w-none sm:px-0">
75+
<MDXContent code={code} components={{ img: MdxImage, code: MdxCode }} />
4776
</div>
4877
)
4978
}

src/components/post-card.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import React from "react"
2+
import type { Post } from "content-collections"
23
import { Link } from "next-view-transitions"
34

45
import { formatDate } from "@/lib/utils"
5-
import type { Post } from "content-collections"
66

77
interface PostCardProps {
88
post: Post
99
}
1010

1111
const PostCard = ({ post }: PostCardProps) => {
12+
const formattedDate = new Intl.DateTimeFormat("es-MX", {
13+
year: "numeric",
14+
month: "short",
15+
day: "numeric"
16+
}).format(new Date(post?.date))
17+
1218
return (
1319
<article className="flex gap-4">
1420
<div className="min-w-[80px] text-right">
1521
<span className="text-muted-foreground font-mono text-xs leading-7 font-light sm:text-sm">
16-
{formatDate(post.date)}
22+
{formattedDate}
1723
</span>
1824
</div>
1925
<div>

src/components/project-card.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type ProjectCardProps = {
1616
stack?: string[]
1717
className?: string
1818
href: string
19+
index?: number
1920
}
2021

2122
const ProjectCard = ({
@@ -24,11 +25,18 @@ const ProjectCard = ({
2425
children,
2526
stack,
2627
className,
27-
href
28+
href,
29+
index = 0
2830
}: ProjectCardProps) => {
2931
const domain = new URL(href)
3032
return (
31-
<motion.div className="rounded-2xl bg-zinc-200/40 p-1">
33+
<motion.div
34+
initial={{ opacity: 0, y: 16 }}
35+
whileInView={{ opacity: 1, y: 0 }}
36+
viewport={{ once: true, margin: "-50px" }}
37+
transition={{ ease: "easeOut", duration: 0.4, delay: index * 0.1 }}
38+
className="rounded-2xl bg-white p-1 shadow inset-ring shadow-black/5 inset-ring-black/10"
39+
>
3240
<div
3341
className={cn(
3442
"relative grid h-[220px] grid-cols-1 gap-2 overflow-hidden rounded-xl border border-white/5 p-4",

styles/globals.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
html {
6060
@apply font-sans;
6161
}
62+
63+
em {
64+
@apply font-display italic;
65+
}
6266
}
6367

6468
@utility border {
@@ -164,9 +168,9 @@
164168
--primary: oklch(64.6% 0.222 41.116);
165169
--primary-foreground: oklch(1 0 0);
166170
--secondary: oklch(0.967 0.001 286.375);
167-
--secondary-foreground: oklch(0.21 0.006 285.885);
171+
--secondary-foreground: oklch(37.15% 0.00004 271.152);
168172
--muted: oklch(0.967 0.001 286.375);
169-
--muted-foreground: oklch(0.552 0.016 285.938);
173+
--muted-foreground: oklch(55.167% 0.01387 285.878);
170174
--accent: oklch(0.967 0.001 286.375);
171175
--accent-foreground: oklch(0.21 0.006 285.885);
172176
--destructive: oklch(0.577 0.245 27.325);

0 commit comments

Comments
 (0)