From a924d4e7482d9d6de90060ea74b83febc601b187 Mon Sep 17 00:00:00 2001 From: BFlat Date: Sat, 27 Jul 2024 00:28:29 +0700 Subject: [PATCH] updates to blog styling mdx stuff (#635) update fixes gap fix update related post heading and leading update --- packages/gatsby-blog/package.json | 3 + packages/gatsby-blog/posts/post-1/index.mdx | 29 ++-- .../gatsby-blog/src/components/Button.tsx | 40 +++++ .../src/components/MdTypography.tsx | 23 ++- .../src/components/SocialIcons.tsx | 36 +++- .../gatsby-blog/src/components/Youtube.tsx | 17 +- .../gatsby-blog/src/components/layout.tsx | 24 +-- .../src/components/postTemplate.tsx | 133 ++++++++++----- packages/gatsby-blog/src/pages/index.tsx | 161 ++++++++++-------- packages/gatsby-blog/src/styles/global.css | 49 +++++- yarn.lock | 9 +- 11 files changed, 364 insertions(+), 160 deletions(-) create mode 100644 packages/gatsby-blog/src/components/Button.tsx diff --git a/packages/gatsby-blog/package.json b/packages/gatsby-blog/package.json index 504df4d3e0..cab654528f 100644 --- a/packages/gatsby-blog/package.json +++ b/packages/gatsby-blog/package.json @@ -16,6 +16,9 @@ "typecheck": "tsc --noEmit" }, "dependencies": { + "@fortawesome/fontawesome-svg-core": "6.2.1", + "@fortawesome/free-brands-svg-icons": "6.2.1", + "@fortawesome/free-solid-svg-icons": "6.2.1", "@mdx-js/react": "^3.0.1", "autoprefixer": "^10.4.19", "gatsby": "^5.13.5", diff --git a/packages/gatsby-blog/posts/post-1/index.mdx b/packages/gatsby-blog/posts/post-1/index.mdx index b781b45945..eef93feaef 100644 --- a/packages/gatsby-blog/posts/post-1/index.mdx +++ b/packages/gatsby-blog/posts/post-1/index.mdx @@ -3,23 +3,26 @@ title: Blog Post 1 slug: /blog-1 date: 2024-07-23 featuredImage: "./2D_many_phases.png" -author: wil -category: +author: Wil +category: --- -# Hello World +## Heading 2 -this is the first post as a prove of concept +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ac neque enim. Nam eget diam sit amet elit aliquet iaculis a id magna. Etiam sit amet tortor libero. Curabitur fringilla ullamcorper magna at ultrices. Aliquam erat volutpat. Fusce sit amet libero maximus, scelerisque dui et, bibendum mi. -**test image** +Mauris justo diam, facilisis sed consequat eu, porttitor in risus. Curabitur in +tempor quam, sit amet pellentesque ex. Proin porta lobortis nulla, vitae tempor +lorem accumsan vitae. Integer pulvinar aliquam mauris et tempus. Vivamus +accumsan facilisis nisi. Aenean quam justo, finibus nec ipsum ut, porttitor +vulputate nunc. Suspendisse a mi in odio dignissim lacinia in in risus. Nam +ultrices nulla eget justo malesuada viverra. + +### Heading 3 + +Quis ligula sem pellentesque ornare eleifend per curabitur quam. Est potenti augue facilisis mi diam. Cras dignissim turpis erat dictum fermentum aptent. Non proin pharetra semper turpis a ipsum mi euismod. Venenatis potenti eleifend auctor dictum neque felis. Quis purus dui lacus fringilla potenti. Ex tempus etiam mus nulla, sociosqu netus lacus ac. Nulla suspendisse fusce dolor nibh faucibus magnis. Sem habitant sed lorem per dictum. ![2-D_Phase_5](./2-D_Phase_5_.jpg) -**test youtube shortcode** - - - - - - -end of doc \ No newline at end of file + +end of doc diff --git a/packages/gatsby-blog/src/components/Button.tsx b/packages/gatsby-blog/src/components/Button.tsx new file mode 100644 index 0000000000..5d4626aa40 --- /dev/null +++ b/packages/gatsby-blog/src/components/Button.tsx @@ -0,0 +1,40 @@ +import { Link } from "gatsby"; +import React, { ReactNode } from "react"; +import { twMerge } from "tailwind-merge"; + +interface ButtonProps { + onClick?: () => void; + to?: string; + children?: ReactNode; + className?: string; + variant?: "primary" | "secondary"; +} + +const Button = ({ + onClick, + to, + children, + className, + variant = "primary", +}: ButtonProps) => { + const baseClasses = + "flex w-fit px-4 py-2 rounded-lg font-semibold text-white hover:bg-primary-400 transition-colors duration-200"; + const variantClasses = variant === "primary" ? "bg-primary" : "bg-secondary"; + const btnClasses = twMerge(baseClasses, variantClasses, className); + + return ( + <> + {onClick ? ( + + ) : ( + + {children} + + )} + + ); +}; + +export default Button; diff --git a/packages/gatsby-blog/src/components/MdTypography.tsx b/packages/gatsby-blog/src/components/MdTypography.tsx index a5c8f6ee6a..a459ed2e04 100644 --- a/packages/gatsby-blog/src/components/MdTypography.tsx +++ b/packages/gatsby-blog/src/components/MdTypography.tsx @@ -1,5 +1,5 @@ import React, { DetailedHTMLProps, HTMLAttributes } from "react"; -import { twMerge } from 'tailwind-merge' +import { twMerge } from "tailwind-merge"; type HeadingProps = DetailedHTMLProps< HTMLAttributes, @@ -11,29 +11,34 @@ export const P = ({ className, ...rest }: DetailedHTMLProps< -HTMLAttributes, -HTMLParagraphElement + HTMLAttributes, + HTMLParagraphElement >) => ( -

+

{children}

); export const H1 = ({ children, className, ...rest }: HeadingProps) => ( -

+

{children}

); export const H2 = ({ children, className, ...rest }: HeadingProps) => ( -

+

{children}

); - export const H3 = ({ children, className, ...rest }: HeadingProps) => ( -

+

{children}

); @@ -54,4 +59,4 @@ export const H6 = ({ children, className, ...rest }: HeadingProps) => (
{children}
-); \ No newline at end of file +); diff --git a/packages/gatsby-blog/src/components/SocialIcons.tsx b/packages/gatsby-blog/src/components/SocialIcons.tsx index ba606ebe25..b42bd9dba0 100644 --- a/packages/gatsby-blog/src/components/SocialIcons.tsx +++ b/packages/gatsby-blog/src/components/SocialIcons.tsx @@ -1,9 +1,35 @@ -import React from "react" +import React from "react"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { + faFacebook, + faInstagram, + faLinkedin, + faTiktok, + faTwitter, +} from "@fortawesome/free-brands-svg-icons"; + +const socialMedia = [ + { icon: faTwitter, link: "https://twitter.com" }, + { icon: faInstagram, link: "https://instagram.com" }, + { icon: faTiktok, link: "https://tiktok.com" }, +]; const SocialIcons = () => { return ( -
I
- ) -} +
+ {socialMedia.map((social, index) => ( + + + + ))} +
+ ); +}; -export default SocialIcons \ No newline at end of file +export default SocialIcons; diff --git a/packages/gatsby-blog/src/components/Youtube.tsx b/packages/gatsby-blog/src/components/Youtube.tsx index 7766429ea7..9f6c694171 100644 --- a/packages/gatsby-blog/src/components/Youtube.tsx +++ b/packages/gatsby-blog/src/components/Youtube.tsx @@ -4,21 +4,20 @@ const respIframeWrapper = { position: "relative" as "relative", height: 0, overflow: "hidden", - paddingBottom: "50%" -} + paddingBottom: "50%", +}; export const Youtube = ({ videoId, title, -}:{ +}: { videoId: string; title?: string; -})=>{ - - return( -
+}) => { + return ( +