Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter embeds #741

Merged
merged 9 commits into from Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/frontend/web/components/elements/TweetBlockComponent.tsx
@@ -0,0 +1,16 @@
import React from 'react';

// tslint:disable:react-no-dangerous-html
export const TweetBlockComponent: React.FC<{
element: TweetBlockElement;
}> = ({ element }) => {
return (
<div>
<div dangerouslySetInnerHTML={{ __html: element.html }} />
<script
async={true}
src="https://platform.twitter.com/widgets.js"
/>
</div>
);
};
3 changes: 3 additions & 0 deletions packages/frontend/web/components/lib/ArticleRenderer.tsx
@@ -1,6 +1,7 @@
import { TextBlockComponent } from '@frontend/web/components/elements/TextBlockComponent';
import { SubheadingBlockComponent } from '@frontend/web/components/elements/SubheadingBlockComponent';
import { ImageBlockComponent } from '@frontend/web/components/elements/ImageBlockComponent';
import { TweetBlockComponent } from '@frontend/web/components/elements/TweetBlockComponent';
import React from 'react';
// import { clean } from '@frontend/model/clean';
export const ArticleRenderer: React.FC<{
Expand Down Expand Up @@ -30,6 +31,8 @@ export const ArticleRenderer: React.FC<{
pillar={pillar}
/>
);
case 'model.dotcomrendering.pageElements.TweetBlockElement':
return <TweetBlockComponent key={i} element={element} />;
default:
return null;
}
Expand Down