-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f9b518
commit ba956f5
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ImageWithAltAndCaption } from './imageWithAltAndCaption' | ||
|
||
export type CarouselImage = { | ||
_type: 'carouselImage' | ||
image: ImageWithAltAndCaption | ||
caption?: string | ||
attribution?: string | ||
} | ||
|
||
export default { | ||
name: 'carouselImage', | ||
title: 'Image with options', | ||
type: 'object', | ||
options: { | ||
collapsed: false, | ||
}, | ||
fields: [ | ||
{ | ||
name: 'image', | ||
title: 'Image with alt and Caption', | ||
type: 'imageWithAltAndCaption', | ||
}, | ||
{ | ||
type: 'boolean', | ||
name: 'captionPositionUnderImage', | ||
title: 'Position caption and credit under image', | ||
description: 'Toggle to display caption and credit under the image.', | ||
initialValue: false, | ||
}, | ||
{ | ||
name: 'link', | ||
title: 'Link', | ||
type: 'linkSelector', | ||
description: 'Optional link associated with the image.', | ||
}, | ||
], | ||
preview: { | ||
select: { | ||
imageUrl: 'image.image.asset.url', | ||
alt: 'image.image.alt', | ||
caption: 'image.caption', | ||
}, | ||
prepare({ imageUrl, caption, alt }: { imageUrl: string; alt: string; caption: string }) { | ||
return { | ||
title: alt || 'No alt text', | ||
subtitle: caption || 'No caption', | ||
media: <img src={imageUrl} alt={alt} style={{ height: '100%' }} />, | ||
} | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters