Skip to content

Commit

Permalink
🎨 add fall back for server (#2626)
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle authored Nov 26, 2024
1 parent e2ade98 commit 70a1884
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 7 additions & 1 deletion 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' },
common: { title: 'Common' },
}
Expand Down Expand Up @@ -295,7 +296,7 @@ const snippets: textSnippet = {
title: 'Pension Category',
defaultValue: 'Pension',
group: groups.pensionForm,
},
},
pension_form_select_topic: {
title: 'Default Pension Category',
defaultValue: 'Pension',
Expand Down Expand Up @@ -816,6 +817,11 @@ const snippets: textSnippet = {
defaultValue: `Please don't enter any personal information`,
group: groups.common,
},
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 70a1884

Please sign in to comment.