Skip to content

Commit 7ed0a86

Browse files
committed
feat(ui): Redefined imageWithAltField for dark mode image
1 parent bf9b507 commit 7ed0a86

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed
Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
import { defineField } from "sanity";
22

33
export const imageWithAltField = defineField({
4-
type: "image",
4+
type: "object",
55
name: "imageWithAltField",
6-
title: "Image",
6+
title: "Image with Light and Dark Mode Support",
77
validation: (Rule) => Rule.required(),
88
fields: [
9+
{
10+
name: "lightImage",
11+
title: "Light Mode Image",
12+
type: "image",
13+
options: {
14+
hotspot: true,
15+
},
16+
validation: (Rule) => Rule.required(),
17+
},
18+
{
19+
name: "darkImage",
20+
title: "Dark Mode Image",
21+
type: "image",
22+
options: {
23+
hotspot: true,
24+
},
25+
},
926
{
1027
name: "alt",
1128
title: "Descriptive label for screen readers & SEO",
1229
type: "string",
30+
validation: (Rule) =>
31+
Rule.required()
32+
.max(150)
33+
.warning(
34+
"Alt text should be descriptive and concise (under 150 characters).",
35+
),
1336
},
1437
],
15-
options: {
16-
hotspot: true,
17-
},
1838
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy