File tree Expand file tree Collapse file tree 1 file changed +25
-5
lines changed
apps/frontend/sanity/schemas/shared Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Original file line number Diff line number Diff line change 1
1
import { defineField } from "sanity" ;
2
2
3
3
export const imageWithAltField = defineField ( {
4
- type : "image " ,
4
+ type : "object " ,
5
5
name : "imageWithAltField" ,
6
- title : "Image" ,
6
+ title : "Image with Light and Dark Mode Support " ,
7
7
validation : ( Rule ) => Rule . required ( ) ,
8
8
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
+ } ,
9
26
{
10
27
name : "alt" ,
11
28
title : "Descriptive label for screen readers & SEO" ,
12
29
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
+ ) ,
13
36
} ,
14
37
] ,
15
- options : {
16
- hotspot : true ,
17
- } ,
18
38
} ) ;
You can’t perform that action at this time.
0 commit comments