Skip to content

Commit

Permalink
Merge branch 'main' into vaash/2609
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunVAshrit authored Nov 26, 2024
2 parents 02979b7 + 70a1884 commit 5e3a197
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 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
13 changes: 8 additions & 5 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 @@ -300,7 +301,7 @@ export const Carousel = forwardRef<HTMLElement, CarouselProps>(function Carousel
return (
<CarouselIframeItem
className="pt-lg"
key={item.id}
key={(item as IFrameCarouselItemData)._key}
noOfSiblings={items.length}
displayMode={displayMode}
aria-label={ariaLabel}
Expand Down Expand Up @@ -356,11 +357,13 @@ export const Carousel = forwardRef<HTMLElement, CarouselProps>(function Carousel
variant === 'image' && displayMode === 'single'
? 'w-[var(--image-carousel-card-w-sm)] md:w-[var(--image-carousel-card-w-md)] lg:w-[var(--image-carousel-card-w-lg)] mx-auto col-start-1 col-end-1 row-start-2 row-end-2'
: ''
} pt-6 pb-2 ${items.length === 2 ? 'lg:hidden' : ''} flex ${
} pt-6 pb-2 ${items.length === 3 ? 'lg:hidden' : ''} flex ${
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const PastEventsListItem = forwardRef<HTMLAnchorElement, PastEventsListItemProps
<FormattedDateParts value={start} year="numeric" month="short" day="2-digit">
{(parts) => {
return (
<div className="flex flex-col gap-4 justify-start items-center">
<div className="flex flex-col gap-4 justify-start items-center text-center">
<span className="text-md">{`${parts[0].value} ${parts[2].value}`}</span>
<span className="text-sm">{parts[4].value}</span>
</div>
Expand Down
15 changes: 10 additions & 5 deletions web/templates/newsroom/sanity/NewsroomSanity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const NewsRoomTemplateSanity = forwardRef<HTMLElement, NewsRoomTemplateProps>(fu
localNewsPages,
fallbackImages,
} = pageData || {}

const intl = useIntl()
const router = useRouter()
const { locale } = router
Expand Down Expand Up @@ -116,10 +117,10 @@ const NewsRoomTemplateSanity = forwardRef<HTMLElement, NewsRoomTemplateProps>(fu
<main ref={ref} className="">
<div className="flex flex-col gap-8 lg:gap-12">
<div className="bg-slate-blue-95 dark py-24">
<div className="flex flex-col gap-4 grid-rows-2 mx-auto px-layout-sm max-w-viewport">
{title && <Heading value={title} as="h1" variant="h2" />}
<div className="flex flex-col gap-4 lg:grid lg:grid-cols-2 lg:grid-rows-[auto_1fr] mx-auto px-layout-sm max-w-viewport">
{title && <Heading value={title} as="h1" variant="h2" className="lg:col-span-2" />}
{ingress && <Blocks value={ingress} />}
<div className="w-full flex flex-col gap-8 lg:flex-row lg:justify-between items-center">
<div className="w-full flex flex-col gap-8 items-center">
<List
role="navigation"
className="max-lg:w-full"
Expand All @@ -139,9 +140,13 @@ const NewsRoomTemplateSanity = forwardRef<HTMLElement, NewsRoomTemplateProps>(fu
{localNewsPages &&
localNewsPages?.length > 0 &&
localNewsPages?.map((localNewsPage) => {
return localNewsPage?.link?.slug ? (
return localNewsPage?.link?.slug || localNewsPage?.href ? (
<List.Item key={localNewsPage.id} className="w-full">
<ResourceLink type={localNewsPage.type} href={localNewsPage?.link?.slug} className="w-full">
<ResourceLink
type={localNewsPage.type}
href={localNewsPage?.link?.slug || (localNewsPage?.href as string)}
className="w-full"
>
{localNewsPage?.label}
</ResourceLink>
</List.Item>
Expand Down

0 comments on commit 5e3a197

Please sign in to comment.