From 31079c40c82263d5c68e7459451fa7796a57ff69 Mon Sep 17 00:00:00 2001 From: Anna Hughes Date: Tue, 17 Dec 2024 15:02:18 +0000 Subject: [PATCH] feat: resource page styles - shorts page (#1235) --- components/cards/RelatedContentCard.tsx | 40 ++++++ .../resources/ResourceCompleteButton.tsx | 16 +-- components/resources/ResourceShortVideo.tsx | 63 ++++++-- components/storyblok/StoryblokCoursePage.tsx | 2 + .../storyblok/StoryblokRelatedContent.tsx | 67 +++++---- .../StoryblokResourceConversationPage.tsx | 7 +- .../storyblok/StoryblokResourceShortPage.tsx | 134 +++++++++++++----- components/storyblok/StoryblokSessionPage.tsx | 2 + components/video/Video.tsx | 34 ++++- constants/enums.ts | 16 +++ constants/events.ts | 7 +- messages/resources/en.json | 3 + messages/shared/en.json | 9 ++ pages/shorts/[slug].tsx | 27 +++- utils/getStoryblokPageProps.ts | 30 +++- 15 files changed, 372 insertions(+), 85 deletions(-) create mode 100644 components/cards/RelatedContentCard.tsx diff --git a/components/cards/RelatedContentCard.tsx b/components/cards/RelatedContentCard.tsx new file mode 100644 index 000000000..2bd1f0a29 --- /dev/null +++ b/components/cards/RelatedContentCard.tsx @@ -0,0 +1,40 @@ +import { Button, Card, CardContent, Typography } from '@mui/material'; +import { useTranslations } from 'next-intl'; +import { RELATED_CONTENT_CATEGORIES } from '../../constants/enums'; +import Link from '../common/Link'; + +const cardStyle = { + mt: 0, + width: { xs: '100%', sm: 'calc(50% - 0.75rem)', md: 'calc(33% - 0.75rem)' }, + mb: { xs: '1rem', sm: '1.5rem' }, +} as const; + +const categoryStyle = { + fontFamily: 'Montserrat, sans-serif', + fontSize: '0.875rem !important', + fontWeight: 500, +} as const; + +interface RelatedContentProps { + title: string; + href: string; + category: RELATED_CONTENT_CATEGORIES; +} + +export const RelatedContentCard = (props: RelatedContentProps) => { + const { title, href, category } = props; + + const t = useTranslations('Shared.relatedContent'); + + return ( + + + {t(category)} + {title} + + + + ); +}; diff --git a/components/resources/ResourceCompleteButton.tsx b/components/resources/ResourceCompleteButton.tsx index 58f5f770f..4c7950c7c 100644 --- a/components/resources/ResourceCompleteButton.tsx +++ b/components/resources/ResourceCompleteButton.tsx @@ -6,9 +6,9 @@ import { RESOURCE_CONVERSATION_COMPLETE_ERROR, RESOURCE_CONVERSATION_COMPLETE_REQUEST, RESOURCE_CONVERSATION_COMPLETE_SUCCESS, - RESOURCE_SHORT_COMPLETE_ERROR, - RESOURCE_SHORT_COMPLETE_REQUEST, - RESOURCE_SHORT_COMPLETE_SUCCESS, + RESOURCE_SHORT_VIDEO_COMPLETE_ERROR, + RESOURCE_SHORT_VIDEO_COMPLETE_REQUEST, + RESOURCE_SHORT_VIDEO_COMPLETE_SUCCESS, } from '../../constants/events'; import { useCompleteResourceMutation } from '../../store/api'; import logEvent, { EventUserData } from '../../utils/logEvent'; @@ -39,7 +39,7 @@ export const ResourceCompleteButton = (props: ResourceCompleteButtonProps) => { const completeResourceAction = async () => { logEvent( category === RESOURCE_CATEGORIES.SHORT_VIDEO - ? RESOURCE_SHORT_COMPLETE_REQUEST + ? RESOURCE_SHORT_VIDEO_COMPLETE_REQUEST : RESOURCE_CONVERSATION_COMPLETE_REQUEST, eventData, ); @@ -51,7 +51,7 @@ export const ResourceCompleteButton = (props: ResourceCompleteButtonProps) => { if (completeResourceResponse.data) { logEvent( category === RESOURCE_CATEGORIES.SHORT_VIDEO - ? RESOURCE_SHORT_COMPLETE_SUCCESS + ? RESOURCE_SHORT_VIDEO_COMPLETE_SUCCESS : RESOURCE_CONVERSATION_COMPLETE_SUCCESS, eventData, ); @@ -63,7 +63,7 @@ export const ResourceCompleteButton = (props: ResourceCompleteButtonProps) => { logEvent( category === RESOURCE_CATEGORIES.SHORT_VIDEO - ? RESOURCE_SHORT_COMPLETE_ERROR + ? RESOURCE_SHORT_VIDEO_COMPLETE_ERROR : RESOURCE_CONVERSATION_COMPLETE_ERROR, eventData, ); @@ -77,8 +77,8 @@ export const ResourceCompleteButton = (props: ResourceCompleteButtonProps) => { return ( <>