From 1c545fab9097826fa25353358ece437dd37be14d Mon Sep 17 00:00:00 2001 From: Ansh Goyal Date: Mon, 4 Mar 2024 16:40:55 +0000 Subject: [PATCH] add other components --- components/newsroom/FeaturedBlogPost.tsx | 133 +++++++++++++++++++++++ components/newsroom/Newsroom.tsx | 117 ++++++++++++++++++++ components/newsroom/NewsroomArticle.tsx | 4 + components/newsroom/NewsroomSection.tsx | 62 +++++++++++ components/newsroom/NewsroomYoutube.tsx | 69 ++++++++++++ components/newsroom/YouTubeCard.tsx | 5 + 6 files changed, 390 insertions(+) create mode 100644 components/newsroom/FeaturedBlogPost.tsx create mode 100644 components/newsroom/Newsroom.tsx create mode 100644 components/newsroom/NewsroomSection.tsx create mode 100644 components/newsroom/NewsroomYoutube.tsx diff --git a/components/newsroom/FeaturedBlogPost.tsx b/components/newsroom/FeaturedBlogPost.tsx new file mode 100644 index 00000000000..d84f19e29be --- /dev/null +++ b/components/newsroom/FeaturedBlogPost.tsx @@ -0,0 +1,133 @@ +import moment from 'moment'; +import Link from 'next/link'; +import TextTruncate from 'react-text-truncate'; + +import { HeadingLevel, HeadingTypeStyle } from '@/types/typography/Heading'; +import { ParagraphTypeStyle } from '@/types/typography/Paragraph'; + +import AuthorAvatars from '../AuthorAvatars'; +import Heading from '../typography/Heading'; +import Paragraph from '../typography/Paragraph'; + +interface Author { + name: string; + photo: string; + link?: string; + } + +interface FeaturedBlogPostProps { + post: { + type: string; + slug: string; + cover: string; + title: string; + excerpt: string; + authors: Author[]; + date: string; + readingTime: number; + }; + className?: string; +} + +/** + * React component for rendering a featured blog post. + * @param {FeaturedBlogPostProps} props - The component props. + * @returns {JSX.Element} JSX element representing the featured blog post. + */ +export default function FeaturedBlogPost({ post, className = '' }: FeaturedBlogPostProps) { + let typeColors = ['bg-indigo-100', 'text-indigo-800']; + + switch (post.type.toLowerCase()) { + case 'video': + typeColors = ['bg-pink-100', 'text-pink-800']; + break; + case 'marketing': + typeColors = ['bg-orange-100', 'text-orange-800']; + break; + case 'strategy': + typeColors = ['bg-green-100', 'text-green-800']; + break; + case 'communication': + typeColors = ['bg-teal-100', 'text-teal-800']; + break; + default: + } + + return ( +
+ +
+ ); +} diff --git a/components/newsroom/Newsroom.tsx b/components/newsroom/Newsroom.tsx new file mode 100644 index 00000000000..197d3bd9045 --- /dev/null +++ b/components/newsroom/Newsroom.tsx @@ -0,0 +1,117 @@ +import { TwitterTimelineEmbed } from 'react-twitter-embed'; + +import { HeadingLevel, HeadingTypeStyle } from '@/types/typography/Heading'; +import { ParagraphTypeStyle } from '@/types/typography/Paragraph'; + +import ArrowRight from '../icons/ArrowRight'; +import Heading from '../typography/Heading'; +import Paragraph from '../typography/Paragraph'; +import TextLink from '../typography/TextLink'; +import NewsroomArticle from './NewsroomArticle'; +import NewsroomBlogPosts from './NewsroomBlogPosts'; +import NewsroomYoutube from './NewsroomYoutube'; + +/** + * A component representing the newsroom section of AsyncAPI website. + * @returns {JSX.Element} The JSX element representing the newsroom section. + */ +export default function Newsroom() { + return ( + <> +
+ + Latest Updates + + + Get a glimpse of latest news, events, and blog posts. Want to publish a blog post? We love community stories. + + Submit yours! + + +
+ +
+
+ + From the blog + + + Check out these articles written by community members + +
+ + Read all blog posts + + +
+
+
+ +
+
+ +
+ +
+
+ + Latest News + + + Read about what people are
saying about AsyncAPI +
+
+ + Follow us on Twitter + + +
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+ +
+ +
+
+ + Video & Live Streams + + + Watch our latest videos and live streams on the AsyncAPI YouTube channel + +
+ + Visit our YouTube channel + + +
+
+
+ +
+
+ + ); +} diff --git a/components/newsroom/NewsroomArticle.tsx b/components/newsroom/NewsroomArticle.tsx index 5acd428833e..be2e0dc8817 100644 --- a/components/newsroom/NewsroomArticle.tsx +++ b/components/newsroom/NewsroomArticle.tsx @@ -13,6 +13,10 @@ interface Article { title: string; } +/** + * Represents an article in the newsroom section. + * @returns {JSX.Element} The JSX element representing the newsroom article. + */ const NewsroomArticle: React.FC = () => { return (