({
children,
className,
}: Props)
| 15 | } |
| 16 | |
| 17 | export default function BlogPostItem({ |
| 18 | children, |
| 19 | className, |
| 20 | }: Props): JSX.Element { |
| 21 | const containerClassName = useContainerClassName(); |
| 22 | const { |
| 23 | isBlogPostPage, |
| 24 | metadata: { authors, tags }, |
| 25 | } = useBlogPost(); |
| 26 | |
| 27 | const authorNames = authors |
| 28 | ? authors.map((author) => author.name).join(", ") |
| 29 | : undefined; |
| 30 | |
| 31 | const tagNames = tags ? tags.map((tag) => tag.label).join(", ") : undefined; |
| 32 | |
| 33 | React.useEffect(() => { |
| 34 | const pageViewData = { |
| 35 | event: "Initialize_dataLayer", |
| 36 | document_type: "Blog", |
| 37 | document_title: document.title, |
| 38 | article_author: authorNames, |
| 39 | tags: tagNames, |
| 40 | }; |
| 41 | if (isBlogPostPage) { |
| 42 | pushGtmEvent(pageViewData); |
| 43 | } |
| 44 | }, [isBlogPostPage]); |
| 45 | return ( |
| 46 | <BlogPostItemContainer className={clsx(containerClassName, className)}> |
| 47 | <BlogPostItemHeader /> |
| 48 | <BlogPostItemContent>{children}</BlogPostItemContent> |
| 49 | <BlogPostItemFooter /> |
| 50 | </BlogPostItemContainer> |
| 51 | ); |
| 52 | } |
nothing calls this directly
no test coverage detected