Skip to content

Commit fdda6cc

Browse files
committed
Merge branch 'bose/3876' into staging
2 parents 51d8b78 + bd14319 commit fdda6cc

4 files changed

Lines changed: 32 additions & 19 deletions

File tree

studio/schemas/objects/ImageWithRichText.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ export default {
4646
type: 'array',
4747
of: [blockContentType],
4848
validation: (Rule: Rule) =>
49-
Rule.custom((value: PortableTextBlock[]) => {
50-
return validateCharCounterEditor(value, 600, true)
51-
}).error(),
49+
Rule.required()
50+
.min(1)
51+
.custom((value: PortableTextBlock[]) => {
52+
return validateCharCounterEditor(value, 600, true)
53+
})
54+
.error(),
5255
},
5356
singleItemArray({
5457
name: 'action',

web/core/Carousel/Carousel.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,18 @@ export const Carousel = forwardRef<HTMLElement, CarouselProps>(
301301
}, [initialPositions])
302302

303303
const getTranslatedItemCountLabel = (item: number) => {
304-
return intl('carouselItemCountLabel', {
304+
let label = `Item ${item} of ${items.length}`
305+
const translatedLabel = intl('carouselItemCountLabel', {
305306
x: item,
306307
carouselLength: items.length,
307308
}).toString()
309+
if (translatedLabel && translatedLabel.length > 0) {
310+
label = translatedLabel
311+
}
312+
313+
return label
308314
}
315+
309316
const cancelTimeout = () => {
310317
timeoutRef.current && clearTimeout(timeoutRef.current)
311318
}
@@ -431,6 +438,7 @@ export const Carousel = forwardRef<HTMLElement, CarouselProps>(
431438
)
432439
}
433440
const getCarouselItem = (item: CarouselItemTypes, i: number) => {
441+
console.log('getCarouselItem', item, i)
434442
switch (variant) {
435443
case 'video':
436444
return getVideoVariantBody(item as VideoPlayerCarouselItem, i)

web/core/Carousel/CarouselImageItem.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ export const CarouselImageItem = forwardRef<
6262
className = '',
6363
action,
6464
wasUserPress = false,
65-
...rest
65+
['aria-label']: ariaLabel,
66+
style,
67+
onFocus,
6668
},
6769
ref,
6870
) {
@@ -71,10 +73,6 @@ export const CarouselImageItem = forwardRef<
7173
() => mergeRefs<HTMLLIElement>(itemRef, ref),
7274
[ref],
7375
)
74-
const isImageWithRichTextCaption = useMemo(
75-
() => type === 'imageWithRichTextBelow' && !!caption,
76-
[caption, type],
77-
)
7876
const isJustImage =
7977
type === 'imageWithAltAndCaption' && !caption && !attribution
8078
const isImageWithSimpleCaption =
@@ -181,16 +179,18 @@ export const CarouselImageItem = forwardRef<
181179
/>
182180
)
183181
}
184-
if (isImageWithRichTextCaption && image) {
182+
if (type === 'imageWithRichTextBelow' && image) {
185183
return (
186184
<figure className='flex h-full w-full flex-col'>
187-
<Image
188-
grid='sm'
189-
image={image}
190-
fill
191-
className={`min-h-single-carousel-card-h-sm w-full rounded-card md:min-h-single-carousel-card-h-md lg:min-h-single-carousel-card-h-lg`}
192-
imageClassName='aspect-4/3 rounded-card md:aspect-video'
193-
/>
185+
<div className='relative aspect-video w-full shrink-0'>
186+
<Image
187+
grid='sm'
188+
image={image}
189+
fill
190+
className='absolute inset-0'
191+
imageClassName='rounded-t-card object-cover'
192+
/>
193+
</div>
194194
<figcaption
195195
className={twMerge(
196196
'h-fit max-w-text p-4 lg:px-8 lg:py-6',
@@ -237,15 +237,17 @@ export const CarouselImageItem = forwardRef<
237237

238238
return (
239239
<li
240-
{...rest}
241240
ref={combinedItemRef}
241+
aria-label={ariaLabel}
242242
{...(displayMode === 'single' && {
243243
'aria-current': active,
244244
tabIndex: active ? 0 : -1,
245245
})}
246246
{...(displayMode === 'scroll' && {
247247
tabIndex: 0,
248248
})}
249+
style={style}
250+
onFocus={onFocus}
249251
className={twMerge(
250252
`relative mt-1 focus:outline-hidden focus-visible:outline-dashed focus-visible:outline-2 focus-visible:outline-grey-50 focus-visible:outline-offset-2 dark:focus-visible:outline-white-100`,
251253
displayMode === 'single' &&

web/sanity/lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const resolveImage = (props: ResolveImageProps) => {
118118
}
119119
//Crops the image to fill the specified width (w) and height (h).
120120
url = urlForImage(image)?.width(width).height(height).fit('crop').url()
121-
121+
console.log('resolveImage url', url)
122122
return { url, width, height }
123123
}
124124

0 commit comments

Comments
 (0)