Jhernandez has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/379598 )
Change subject: Chore: Use Content in PageSummary for HTML content
......................................................................
Chore: Use Content in PageSummary for HTML content
In order to get the correct typography styles, HTML content should be
put inside the Content component.
I haven't used it in the Title in wiki.tsx because it seems it is only
simple HTML.
Change-Id: I6dbc02a26265a91f5f0e3a7a53c6b3551a08eb23
---
M src/common/components/content/content.tsx
M src/common/components/page-summary/page-summary.tsx
2 files changed, 17 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/98/379598/1
diff --git a/src/common/components/content/content.tsx
b/src/common/components/content/content.tsx
index 493238c..4b903b1 100644
--- a/src/common/components/content/content.tsx
+++ b/src/common/components/content/content.tsx
@@ -1,10 +1,22 @@
-import { h } from "preact";
+import { h, DangerouslySetInnerHTML } from "preact";
import { classOf, ClassProps, ChildrenProps } from "../preact-utils";
import "./content.css";
+interface Props extends ChildrenProps, ClassProps {
+ dangerouslySetInnerHTML?: DangerouslySetInnerHTML;
+}
+
export default function Content({
children,
+ dangerouslySetInnerHTML,
...props
-}: ChildrenProps & ClassProps): JSX.Element {
- return <div class={classOf("Content", props.class)}>{children}</div>;
+}: Props): JSX.Element {
+ return (
+ <div
+ class={classOf("Content", props.class)}
+ dangerouslySetInnerHTML={dangerouslySetInnerHTML}
+ >
+ {children}
+ </div>
+ );
}
diff --git a/src/common/components/page-summary/page-summary.tsx
b/src/common/components/page-summary/page-summary.tsx
index 02f38f3..5581211 100644
--- a/src/common/components/page-summary/page-summary.tsx
+++ b/src/common/components/page-summary/page-summary.tsx
@@ -1,6 +1,7 @@
import { h } from "preact";
import "./page-summary.css";
import { PageSummary as PageSummaryModel } from "../../models/page";
+import Content from "../content/content";
export interface Props {
summary: PageSummaryModel;
@@ -10,7 +11,7 @@
<div class="PageSummary">
<Thumbnail summary={summary} />
{summary.extractHTML && (
- <div
+ <Content
class="PageSummary-extract"
dangerouslySetInnerHTML={{ __html: summary.extractHTML }}
/>
--
To view, visit https://gerrit.wikimedia.org/r/379598
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dbc02a26265a91f5f0e3a7a53c6b3551a08eb23
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits