Skip to content

Commit

Permalink
πŸ› Add check for singlepromotion #2420 (#2424)
Browse files Browse the repository at this point in the history
* πŸ› Add check for singlepromotion #2420

* πŸ”‡ Remove console.log #2420

* πŸ› Adding noInvert prop for card with coloredbackground #2420
  • Loading branch information
millianapia authored Sep 25, 2024
1 parent ed78e32 commit ba5ed10
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const EventPromotionPreview = (props: EventPromotionPreviewProps) => {
return setTitle(`Showing ${number} ${time} ${promoteSingleUpcomingEvent ? 'event' : 'events'} ${withTags}`)
}, [manuallySelectEvents, promotedEvents, useTags, tags, pastEventsCount, promoteSingleUpcomingEvent])

console.log('title', title)
return (
<Flex align="center">
<Box flex={1}>
Expand Down
8 changes: 7 additions & 1 deletion web/pageComponents/shared/portableText/Blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export type BlockProps = {
/** Use to clamp lines on number */
clampLines?: number
includeFootnotes?: boolean
noInvert?: boolean
} & PortableTextProps

const inlineBlockTypes = ['block', 'positionedInlineImage', 'pullQuote', 'basicIframe']
Expand All @@ -139,6 +140,7 @@ export default function Blocks({
id,
clampLines,
includeFootnotes = false,
noInvert = false,
}: BlockProps) {
let div: PortableTextBlock[] = []
return (
Expand All @@ -158,7 +160,11 @@ export default function Blocks({
div = []

return (
<div key={block._key} className={twMerge(`prose ${proseClassName} dark:prose-invert`, className)} id={id}>
<div
key={block._key}
className={twMerge(`prose ${proseClassName} ${noInvert ? '' : `dark:prose-invert`}`, className)}
id={id}
>
<PortableText
value={value}
//@ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion web/pageComponents/topicPages/Promotion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Promotion = ({
<IngressText value={ingress} />
</div>
)}
{promotions?.length === 1 ? (
{promotions?.length === 1 || promoteSingleUpcomingEvent ? (
<SinglePromotion promotion={promotions[0]} hasSectionTitle={!!title} />
) : (
<MultiplePromotions
Expand Down
2 changes: 1 addition & 1 deletion web/sections/cards/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const Card = forwardRef<HTMLAnchorElement, CardProps>(function Card(
text-slate-80
focus:outline-none
focus-visible:envis-outline
dark:text-white-100
dark:text-slate-80
dark:focus-visible:envis-outline-invert
`,
className,
Expand Down
1 change: 0 additions & 1 deletion web/sections/cards/Card/CardContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const CardContent = forwardRef<HTMLDivElement, CardContentProps>(function
`
size-arrow-right
text-energy-red-100
dark:text-white-100
mr-2
group-hover/card:translate-x-2
transition-all
Expand Down
1 change: 1 addition & 0 deletions web/sections/cards/Card/CardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const CardHeader = forwardRef<HTMLDivElement, CardHeaderProps>(function C
${variantTitle[variant]}
max-w-prose
text-pretty
dark:text-slate-80
`,
titleClassName,
)
Expand Down
1 change: 1 addition & 0 deletions web/sections/cards/PromotionCard/PromotionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const PromotionCard = forwardRef<HTMLAnchorElement, PromotionCardProps>(function
/>
{ingress && (
<Blocks
noInvert
value={ingress}
className={`break-word max-w-prose grow ${
type !== 'news' && type !== 'localNews' ? '' : 'hidden lg:block'
Expand Down

0 comments on commit ba5ed10

Please sign in to comment.