You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/05/25 02:56:27 UTC

[GitHub] [apisix-website] juzhiyuan commented on a diff in pull request #1118: feat: image zoom

juzhiyuan commented on code in PR #1118:
URL: https://github.com/apache/apisix-website/pull/1118#discussion_r881172157


##########
website/src/theme/BlogPostPage/index.tsx:
##########
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+import React from 'react';
+import Seo from '@theme/Seo';
+import BlogLayout from '@theme-original/BlogLayout';
+import BlogPostItem from '@theme-original/BlogPostItem';
+import BlogPostPaginator from '@theme-original/BlogPostPaginator';
+import type { Props } from '@theme-original/BlogPostPage';
+// eslint-disable-next-line import/no-extraneous-dependencies
+import { ThemeClassNames } from '@docusaurus/theme-common';
+import MDXComponents from '@theme-original/MDXComponents';
+import type { ImageProps } from 'rc-image';
+import Image from 'rc-image';
+// eslint-disable-next-line import/no-extraneous-dependencies
+import { MDXProvider } from '@mdx-js/react';
+
+const components = {
+  ...MDXComponents,
+  img: (props: ImageProps) => <Image {...props} preview={{ mask: 'Click to Preview' }} />,
+};
+
+const BlogPostPage = (props: Props): JSX.Element => {
+  const { content: BlogPostContents, sidebar } = props;
+  const { frontMatter, assets, metadata } = BlogPostContents;
+  const {
+    title,
+    description,
+    nextItem,
+    prevItem,
+    date,
+    tags,
+    authors,
+  } = metadata;
+  const { hide_table_of_contents: hideTableOfContents, keywords } = frontMatter;
+
+  const image = assets.image ?? frontMatter.image;
+
+  return (
+    <BlogLayout
+      wrapperClassName={ThemeClassNames.wrapper.blogPages}
+      pageClassName={ThemeClassNames.page.blogPostPage}
+      sidebar={sidebar}
+      toc={
+        !hideTableOfContents && BlogPostContents.toc
+          ? BlogPostContents.toc
+          : undefined
+      }
+    >
+      <Seo
+        // TODO refactor needed: it's a bit annoying but Seo MUST be inside BlogLayout

Review Comment:
   @SkyeYoung How about adding an issue to track?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org