diff --git a/sites/shared/components/github/create-showcase.mjs b/sites/org/components/github/create-showcase.mjs similarity index 79% rename from sites/shared/components/github/create-showcase.mjs rename to sites/org/components/github/create-showcase.mjs index 1df46e74ee6..cb3a19b9c4c 100644 --- a/sites/shared/components/github/create-showcase.mjs +++ b/sites/org/components/github/create-showcase.mjs @@ -1,5 +1,5 @@ // Dependencies -import { nsMerge, capitalize, cloudflareImageUrl } from 'shared/utils.mjs' +import { nsMerge, capitalize, cloudflareImageUrl, yyyymmdd } from 'shared/utils.mjs' // Hooks import { useState, useEffect } from 'react' import { useAccount } from 'shared/hooks/use-account.mjs' @@ -21,6 +21,7 @@ import { import { Collapse } from 'shared/components/collapse.mjs' import { Tab } from 'shared/components/account/bio.mjs' import { CodeBox } from 'shared/components/code-box.mjs' +import { PostArticle } from 'site/components/mdx/posts/article.mjs' export const ns = nsMerge('account', authNs) @@ -165,45 +166,33 @@ export const CreateShowcasePost = ({ noTitle = false }) => { {img ? ( <> Here you can add any images you want to include in the post body. - {Object.keys(extraImages).map((key) => ( - <> - setExtraImg(key, img)} - type="showcase" - subId={key} - img={extraImages[key]} - slug={slug} - /> - - ))} + {Object.keys(extraImages).map((key) => { + const markup = + '![The image alt goes here](' + + cloudflareImageUrl({ id: extraImages[key], variant: 'public' }) + + ' "The image caption/title goes here")' + return ( + <> + setExtraImg(key, img)} + type="showcase" + subId={key} + img={extraImages[key]} + slug={slug} + /> + {extraImages[key] && ( + <> +

To include this image in your post, use this markdown snippet:

+ + + )} + + ) + })} - {Object.keys(extraImages).length > 0 && ( - <> -
Using extra images in your post
-

To include these images, use this markup:

- - {Object.keys(extraImages) - .map((key) => `[Image caption here][img${key}]`) - .join('\n\n')} - -

Then, at at the bottom of your post, make sure to include this:

- - {Object.keys(extraImages) - .map( - (key) => - `[img${key}]: ${cloudflareImageUrl({ - id: extraImages[key], - variant: 'main', - })}` - ) - .join('\n')} - -

-                    
-                  )}
                 
               ) : (
                 
@@ -223,7 +212,20 @@ export const CreateShowcasePost = ({ noTitle = false }) => {
             
           
         ) : (
-          

Post preview here

+ <> +

{title}

+ + )} diff --git a/sites/shared/components/github/design-picker.mjs b/sites/org/components/github/design-picker.mjs similarity index 100% rename from sites/shared/components/github/design-picker.mjs rename to sites/org/components/github/design-picker.mjs diff --git a/sites/shared/components/github/inputs.mjs b/sites/org/components/github/inputs.mjs similarity index 100% rename from sites/shared/components/github/inputs.mjs rename to sites/org/components/github/inputs.mjs diff --git a/sites/org/components/mdx/posts/article.mjs b/sites/org/components/mdx/posts/article.mjs index 538eb774ecc..ad2fa2c3f19 100644 --- a/sites/org/components/mdx/posts/article.mjs +++ b/sites/org/components/mdx/posts/article.mjs @@ -6,55 +6,84 @@ import { TimeAgo } from 'shared/components/mdx/meta.mjs' import { useTranslation } from 'next-i18next' import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs' import { cloudflareImageUrl } from 'shared/utils.mjs' +import Markdown from 'react-markdown' export const ns = ['common', 'posts'] -export const PostArticle = ({ frontmatter, MDX, imgId }) => { +export const PostArticle = (props) => { const { t } = useTranslation('common') + return ( - + + + + + + ) } + +const PostWrapper = ({ children }) =>
{children}
+ +const PostMeta = ({ frontmatter, t }) => ( +
+
+ [{frontmatter.date}] +
+
+ {frontmatter.designs?.map((design) => ( + + ))} +
+ +
+) + +const PostImage = ({ imgId, frontmatter }) => ( +
+ + + {frontmatter.caption} + +
+ +
+) + +const PostAuthor = ({ frontmatter }) => ( +
+ +
+) + +const PostContent = (props) => + props.MDX ? : + +const PostMDXContent = ({ MDX }) => ( +
+ {MDX} +
+) + +const PostPreviewContent = ({ body }) => ( +
+ {body} +
+) diff --git a/sites/org/pages/new/showcase.mjs b/sites/org/pages/new/showcase.mjs index 511ef6f8dbe..e69a5492a1d 100644 --- a/sites/org/pages/new/showcase.mjs +++ b/sites/org/pages/new/showcase.mjs @@ -6,7 +6,7 @@ import { useTranslation } from 'next-i18next' import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs' import { ns as authNs } from 'shared/components/wrappers/auth/index.mjs' import { ns as apikeysNs } from 'shared/components/account/apikeys.mjs' -import { CreateShowcasePost } from 'shared/components/github/create-showcase.mjs' +import { CreateShowcasePost } from 'site/components/github/create-showcase.mjs' // Translation namespaces used on this page const namespaces = [...new Set([...apikeysNs, ...authNs, ...pageNs])] diff --git a/sites/shared/components/code-box.mjs b/sites/shared/components/code-box.mjs index a18acb8e5da..6d4f5e638c7 100644 --- a/sites/shared/components/code-box.mjs +++ b/sites/shared/components/code-box.mjs @@ -1,7 +1,21 @@ -export const CodeBox = ({ children }) => ( +import { CopyIcon } from 'shared/components/icons.mjs' +import { CopyToClipboard } from 'shared/components/copy-to-clipboard.mjs' + +export const CodeBox = ({ code, title }) => (
+
+ {title} + +
-      {children}
+      {code}
     
) diff --git a/sites/shared/components/copy-to-clipboard.mjs b/sites/shared/components/copy-to-clipboard.mjs index 8ba5f9594ca..e68bb8ffa16 100644 --- a/sites/shared/components/copy-to-clipboard.mjs +++ b/sites/shared/components/copy-to-clipboard.mjs @@ -1,6 +1,6 @@ import ReactDOMServer from 'react-dom/server' import { useState } from 'react' -import { CopyIcon } from 'shared/components/icons.mjs' +import { CopyIcon, OkIcon } from 'shared/components/icons.mjs' import { CopyToClipboard as Copy } from 'react-copy-to-clipboard' const strip = (html) => @@ -22,7 +22,11 @@ export const CopyToClipboard = ({ content }) => { return ( handleCopied(setCopied)}> )