Skip to content

Commit bd012ad

Browse files
committed
🎨 fix grid arrow and grid text block to richtext variants
1 parent 0e7ea53 commit bd012ad

11 files changed

Lines changed: 92 additions & 30 deletions

File tree

studio/icons/customIcons.tsx

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ export const SmallSizeImage = (): JSX.Element => (
6464
<svg
6565
width='48'
6666
height='48'
67+
style={{
68+
width: '100%',
69+
height: 'auto',
70+
}}
6771
viewBox='0 0 48 48'
6872
fill='none'
6973
xmlns='http://www.w3.org/2000/svg'
@@ -86,6 +90,10 @@ export const LeftAlignedImage = (): JSX.Element => (
8690
width='48'
8791
height='48'
8892
viewBox='0 0 48 48'
93+
style={{
94+
width: '100%',
95+
height: 'auto',
96+
}}
8997
aria-labelledby='leftAlignedTitle'
9098
fill='currentColor'
9199
stroke='currentColor'
@@ -103,7 +111,10 @@ export const LeftAlignedImage = (): JSX.Element => (
103111
export const ContentCenterImage = (): JSX.Element => (
104112
<svg
105113
xmlns='http://www.w3.org/2000/svg'
106-
className='icon icon-tabler icon-tabler-align-box-center-middle-filled'
114+
style={{
115+
width: '100%',
116+
height: 'auto',
117+
}}
107118
width='48'
108119
height='48'
109120
viewBox='0 0 24 24'
@@ -124,9 +135,12 @@ export const ContentCenterImage = (): JSX.Element => (
124135
export const ContentLeftImage = (): JSX.Element => (
125136
<svg
126137
xmlns='http://www.w3.org/2000/svg'
127-
className='icon icon-tabler icon-tabler-align-box-left-middle-filled'
128138
width='48'
129139
height='48'
140+
style={{
141+
width: '100%',
142+
height: 'auto',
143+
}}
130144
viewBox='0 0 24 24'
131145
strokeWidth='1.5'
132146
stroke='currentColor'
@@ -146,7 +160,10 @@ export const ContentLeftImage = (): JSX.Element => (
146160
export const ContentRightImage = (): JSX.Element => (
147161
<svg
148162
xmlns='http://www.w3.org/2000/svg'
149-
className='icon icon-tabler icon-tabler-align-box-right-middle-filled'
163+
style={{
164+
width: '100%',
165+
height: 'auto',
166+
}}
150167
width='48'
151168
height='48'
152169
viewBox='0 0 24 24'
@@ -167,7 +184,10 @@ export const ContentRightImage = (): JSX.Element => (
167184
export const ContentBottomCenterImage = (): JSX.Element => (
168185
<svg
169186
xmlns='http://www.w3.org/2000/svg'
170-
className='icon icon-tabler icon-tabler-align-box-right-middle-filled'
187+
style={{
188+
width: '100%',
189+
height: 'auto',
190+
}}
171191
width='48'
172192
height='48'
173193
viewBox='0 0 24 24'
@@ -181,7 +201,10 @@ export const ContentBottomCenterImage = (): JSX.Element => (
181201
export const ContentBottomLeftImage = (): JSX.Element => (
182202
<svg
183203
xmlns='http://www.w3.org/2000/svg'
184-
className=''
204+
style={{
205+
width: '100%',
206+
height: 'auto',
207+
}}
185208
width='48'
186209
height='48'
187210
viewBox='0 0 24 24'
@@ -197,6 +220,10 @@ export const RightAlignedImage = (): JSX.Element => (
197220
<svg
198221
width='48'
199222
height='48'
223+
style={{
224+
width: '100%',
225+
height: 'auto',
226+
}}
200227
viewBox='0 0 48 48'
201228
aria-labelledby='rightAlignedTitle'
202229
fill='currentColor'

studio/schemas/components/RadioIconSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const RadioIconSelector = ({
9393
? option.icon()
9494
: option.icon}
9595
</div>
96-
<p style={{ margin: 0 }}>{option.value}</p>
96+
<p style={{ margin: 0, textAlign: 'center' }}>{option.value}</p>
9797
</div>
9898
</label>
9999
</div>

studio/schemas/objects/grid/cellTypes/gridTextBlock.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import {
2323

2424
const blockContentType = configureBlockContent({ variant: 'extendedBlock' })
2525
const themedTitleContentType = configureBlockContent({
26-
variant: 'with2XLTitle',
26+
variant: 'richTitleH2',
2727
})
28-
const titleContentType = configureBlockContent({ variant: 'title' })
28+
const titleContentType = configureBlockContent({ variant: 'titleH2' })
2929

3030
const contentAlignmentOptions = [
3131
{ value: 'left', icon: ContentLeftImage },

studio/styles/fonts.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
--font-3xl: clamp(calc(39.81 / 16 * 1rem), 1.77vw + 2.07rem, calc(67.14 / 16 * 1rem));
2020
--font-4xl: clamp(calc(45.89 / 16 * 1rem), 2.16vw + 2.355rem, calc(79.225 / 16 * 1rem));
2121
--font-5xl: clamp(calc(51.97 / 16 * 1rem), 2.55vw + 2.64rem, calc(91.31 / 16 * 1rem));
22-
--font-5xl: clamp(calc(51.97 / 16 * 1rem), 2.55vw + 2.64rem, calc(91.31 / 16 * 1rem));
2322
--font-6xl: clamp(calc(58.05 / 16 * 1rem), 2.94vw + 2.925rem, calc(103.39 / 16 * 1rem));
2423
--font-8xl: clamp(calc(59.19 / 16 * 1rem), 3.72vw + 3.495rem, calc(115.47 / 16 * 1rem));
2524
--tracking-display: -3px;
@@ -53,7 +52,9 @@
5352
margin: 0;
5453
}
5554
.pt-editable .pt-block:has([data-group='display']) [data-text] *:where([data-slate-leaf='true']) {
56-
white-space: normal;
55+
/*white-space: normal; Did not work, tried to avoid pre-wrap because used together with other styles it can make an empty line
56+
in eitor when text gets wrapped. Looks wrong with the emtpy pre-wrapped line with a cursor to write...
57+
But with out pre-wrap the space doesnt show in editor... */
5758
}
5859
.pt-editable .text-sm *:where([data-slate-leaf='true']) {
5960
font-size: var(--font-sm);

web/core/Carousel/Carousel.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
type ElementType,
77
forwardRef,
88
type HTMLAttributes,
9+
type ReactNode,
910
useCallback,
1011
useEffect,
1112
useId,
@@ -69,6 +70,7 @@ type CarouselProps = {
6970
title?: PortableTextBlock[]
7071
/** Variant Image: The section title to be used in translated autorotation control button */
7172
sectionTitle?: PortableTextBlock[]
73+
getVariantElementBody?: (itemData: any, index?: number) => JSX.Element
7274
} & Omit<HTMLAttributes<HTMLDivElement>, 'title'>
7375

7476
const TRANSLATE_X_AMOUNT_LG = 1000
@@ -89,6 +91,7 @@ export const Carousel = forwardRef<HTMLElement, CarouselProps>(
8991
listClassName = '',
9092
hasSectionTitle = false,
9193
sectionTitle,
94+
getVariantElementBody,
9295
},
9396
ref,
9497
) {
@@ -342,7 +345,9 @@ const [scrollPosition, setScrollPosition] = useState<'start' | 'middle' | 'end'>
342345
)
343346
}
344347
const getEventVariantBody = (itemData: EventCardData, index: number) => {
345-
const element = (
348+
const element = getVariantElementBody ? (
349+
getVariantElementBody(itemData)
350+
) : (
346351
<EventCard
347352
hasSectionTitle={hasSectionTitle}
348353
data={itemData}

web/sections/Grid/GridLinkArrow.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const GridLinkArrow = forwardRef<HTMLDivElement, GridLinkArrowProps>(
2020
{ action, className = '', bgColor, variant = 'square' },
2121
ref,
2222
) {
23+
console.log('GridLinkArrow bgColor', bgColor)
2324
const url = action && getUrlFromAction(action)
2425

2526
const bgClassName = () => {
@@ -34,7 +35,7 @@ const GridLinkArrow = forwardRef<HTMLDivElement, GridLinkArrowProps>(
3435
case 'bg-white-100':
3536
return `text-slate-80 hover:bg-grey-50 hover:text-white-100 focus-visible:bg-grey-50 focus-visible:text-white-100`
3637
default:
37-
return `text-white-100 hover:bg-white-100 hover:text-slate-80 dark:hover:bg-white-100 dark:hover:text-slate-80 focus-visible:bg-white-100 focus-visible:text-slate-80`
38+
return `text-white-100 hover:bg-white-100 hover:text-slate-80 dark:hover:bg-white-100 dark:hover:*:text-slate-80 focus-visible:bg-white-100 focus-visible:text-slate-80`
3839
}
3940
}
4041

@@ -53,7 +54,7 @@ const GridLinkArrow = forwardRef<HTMLDivElement, GridLinkArrowProps>(
5354
<div
5455
ref={ref}
5556
className={twMerge(
56-
`focus-visible:-translate-x-[5px] focus-visible:-translate-y-[5px] absolute right-0 bottom-0 flex w-full justify-end 3xl:pt-12 pt-4`,
57+
`focus-visible:-translate-x-1.25 focus-visible:-translate-y-1.25 absolute right-0 bottom-0 flex w-full justify-end 3xl:pt-12 pt-4`,
5758
className,
5859
)}
5960
>

web/sections/Grid/Span3.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
'use client'
2+
import { forwardRef, type HTMLAttributes } from 'react'
23
import { twMerge } from 'tailwind-merge'
3-
import { HTMLAttributes, forwardRef } from 'react'
44
import { mapGridContent } from './mapGridContent'
55

66
export type Span3Props = {
77
data: any
88
className?: string
99
} & HTMLAttributes<HTMLDivElement>
1010

11-
const Span3 = forwardRef<HTMLDivElement, Span3Props>(function Span3({ data, className = '', ...rest }, ref) {
12-
const minHeight = data?.content?.type === 'videoPlayer' ? '' : 'min-h-[350px] lg:min-h-[600px]'
11+
const Span3 = forwardRef<HTMLDivElement, Span3Props>(function Span3(
12+
{ data, className = '', ...rest },
13+
ref,
14+
) {
15+
const minHeight =
16+
data?.content?.type === 'videoPlayer'
17+
? ''
18+
: 'min-h-[350px] lg:min-h-[600px]'
1319

1420
return (
1521
<div
1622
ref={ref}
17-
className={twMerge(`h-full w-full border border-moss-green-60 lg:col-span-3 ${minHeight} `, className)}
23+
className={twMerge(
24+
`h-full w-full border border-moss-green-60 lg:col-span-3 ${minHeight} `,
25+
className,
26+
)}
1827
{...rest}
1928
>
2029
{mapGridContent(data?.content, 'span3')}

web/sections/Grid/mapGridContent.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
'use client'
2-
import { IFrameData } from '../../types/index'
2+
import { VideoPlayer } from '@/core/VideoJsPlayer/VideoPlayer'
3+
import type { IFrameData } from '../../types/index'
4+
import type { FigureData } from '../Figure/Figure'
35
import IFrame from '../IFrameBlock/IFrameBlock'
4-
import GridTextBlock from './GridTextBlock'
5-
import { GridTeaser } from './GridTeaser'
6+
import type { VideoPlayerBlockProps } from '../VideoPlayerBlock/VideoPlayerBlock'
67
import GridFigure from './GridFigure'
7-
import { FigureData } from '../Figure/Figure'
8-
import { VideoPlayer } from '@/core/VideoJsPlayer/VideoPlayer'
9-
import { VideoPlayerBlockProps } from '../VideoPlayerBlock/VideoPlayerBlock'
8+
import { GridTeaser } from './GridTeaser'
9+
import GridTextBlock from './GridTextBlock'
1010

1111
export type RowType = 'span3' | 'span2and1' | 'threeColumns' | undefined
1212

13-
export const mapGridContent = (data: any, rowType?: RowType): React.ReactNode => {
13+
export const mapGridContent = (
14+
data: any,
15+
rowType?: RowType,
16+
): React.ReactNode => {
1417
//@ts-ignore:so many types
1518
switch (data.type) {
1619
case 'gridTextBlock':
17-
return <GridTextBlock key={data.id} data={data as any} rowType={rowType} />
20+
return (
21+
<GridTextBlock key={data.id} data={data as any} rowType={rowType} />
22+
)
1823
case 'gridTeaser':
1924
return <GridTeaser key={data.id} data={data as any} rowType={rowType} />
2025
case 'figure':

web/sections/cards/EventCard/EventCard.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import FormattedDateTime, {
1111
TimeIcon,
1212
} from '@/core/FormattedDateTime/FormattedDateTime'
1313
import { BaseLink } from '@/core/Link/BaseLink'
14+
import { defaultLanguage } from '@/languageConfig'
1415
import { getEventDates } from '@/lib/helpers/dateUtilities'
16+
import { getLocaleFromIso } from '@/sanity/helpers/localization'
1517
import {
1618
type ColorKeys,
1719
colorKeyToUtilityMap,
1820
} from '@/styles/colorKeyToUtilityMap'
1921
import AddToCalendar from '../../../core/AddToCalendar/AddToCalendar'
2022
import Blocks from '../../../portableText/Blocks'
21-
import { defaultLanguage } from '@/languageConfig'
22-
import { getLocaleFromIso } from '@/sanity/helpers/localization'
2323

2424
type Variants = 'default' | 'single' | 'carousel'
2525

@@ -74,9 +74,9 @@ const EventCard = forwardRef<HTMLDivElement, EventCardProps>(function EventCard(
7474
} = data
7575

7676
const iso = useLocale()
77-
const locale = iso!== defaultLanguage.name? getLocaleFromIso(iso) :""
78-
const href = ("/"+locale+ slug) || ''
79-
77+
const locale = iso !== defaultLanguage.name ? getLocaleFromIso(iso) : ''
78+
const href = '/' + locale + slug || ''
79+
8080
const formatter = useFormatter()
8181
const { start, end } = getEventDates(eventDate)
8282
const { dayTime: startDayTime, overrideTimeLabel: startTimeLabel } =

web/sections/promotions/PromotionsBlock.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ const PromotionsBlock = ({
135135

136136
const { backgroundImage, backgroundPosition } = designOptions || {}
137137

138+
console.log('promotion data', data)
139+
138140
const promotionVariant =
139141
variant ?? mapOldPromoType(data.promotions?.[0]?.type) ?? 'promoteTopics'
140142

@@ -157,6 +159,7 @@ const PromotionsBlock = ({
157159
}, [promotions, eventsCount])
158160

159161
const onColorBg = designOptions?.background?.backgroundColor !== 'White'
162+
console.log('onColorBg', onColorBg)
160163
const paddingClassName = `px-layout-sm lg:px-layout-lg`
161164

162165
return (

0 commit comments

Comments
 (0)