Skip to content

Commit

Permalink
Merge branch 'bose/2599' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Nov 3, 2024
2 parents 0388b39 + f702613 commit 815c82d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
16 changes: 7 additions & 9 deletions sanityv3/schemas/objects/card.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
/* eslint-disable react/display-name */
import { configureBlockContent } from '../editors'
import type { PortableTextBlock } from 'sanity'
import { Stack, Text, Card } from '@sanity/ui'
import { Text, Card, Box } from '@sanity/ui'
import blocksToText from '../../helpers/blocksToText'

const CardField = (props: any) => {
const { renderDefault } = props
return (
<Stack>
<Card padding={3} borderLeft>
<Text muted size={2} align={'left'}>
If only title are used it will render only title as statement. If content below are used, both title and
content will be rendered.
</Text>
</Card>
<Box>
<Text muted size={2} align="left" style={{ marginBottom: 20 }}>
If only title are used it will render only title as statement. If content below are used, both title and content
will be rendered.
</Text>
<>{renderDefault(props)}</>
</Stack>
</Box>
)
}

Expand Down
6 changes: 6 additions & 0 deletions sanityv3/schemas/textSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const groups = {
pensionForm: { title: 'Pension form', hidden: !Flags.HAS_PENSION_FORM },
form: { title: 'Form', hidden: !Flags.HAS_FORMS },
cookie: { title: 'Cookie' },
carousel: { title: 'Carousel' },
others: { title: 'Others' },
}
const snippets: textSnippet = {
Expand Down Expand Up @@ -942,6 +943,11 @@ const snippets: textSnippet = {
defaultValue: 'Select all',
group: groups.others,
},
carousel_controls: {
title: 'Carousel controls',
defaultValue: 'Carousel controls',
group: groups.carousel,
},
}

type textSnippetGroup = { title: string; hidden?: boolean }
Expand Down
9 changes: 6 additions & 3 deletions web/core/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { useMediaQuery } from '../../lib/hooks/useMediaQuery'
import { CarouselEventItem } from './CarouselEventItem'
import { CarouselKeyNumberItem } from './CarouselKeyNumberItem'
import { CarouselIframeItem } from './CarouselIframeItem'
import { FormattedMessage } from 'react-intl'

export type DisplayModes = 'single' | 'scroll'
export type Layouts = 'full' | 'default'
Expand Down Expand Up @@ -360,7 +361,9 @@ export const Carousel = forwardRef<HTMLElement, CarouselProps>(function Carousel
internalAutoRotation ? 'justify-between' : 'justify-end'
}`}
>
<div id={controlsId} className="sr-only">{`Carousel controls`}</div>
<div id={controlsId} className="sr-only">
<FormattedMessage id="carousel_controls" defaultMessage="Carousel controls" />
</div>
{internalAutoRotation && (
<MediaButton
key={`play_pause_button_${currentIndex}`}
Expand All @@ -378,7 +381,7 @@ export const Carousel = forwardRef<HTMLElement, CarouselProps>(function Carousel
title={`Go to previous`}
aria-controls={carouselItemsId}
mode="previous"
disabled={displayMode === 'scroll' && scrollPosition === 'start'}
disabled={(displayMode === 'scroll' && scrollPosition === 'start') ?? false}
onClick={() => {
if (variant === 'image' && displayMode === 'single') {
loopSlidePrev()
Expand All @@ -395,7 +398,7 @@ export const Carousel = forwardRef<HTMLElement, CarouselProps>(function Carousel
title={`Go to next`}
mode="next"
aria-controls={carouselItemsId}
disabled={displayMode === 'scroll' && scrollPosition === 'end'}
disabled={(displayMode === 'scroll' && scrollPosition === 'end') ?? false}
onClick={() => {
if (variant === 'image' && displayMode === 'single') {
loopSlideNext()
Expand Down

0 comments on commit 815c82d

Please sign in to comment.