Skip to content

Commit

Permalink
Feature/holopin (#437)
Browse files Browse the repository at this point in the history
* adds holopin image

* bump versions and update tests

* snapshots update

* fixes holopin link

* fixes holopin link

* refactor and colour change

* demo holopin interactive

* demo holopin interactive

* migrate to appdir

* added Fathom

* added Fathom
  • Loading branch information
kochie authored Mar 14, 2023
1 parent 23474fe commit 92244fb
Show file tree
Hide file tree
Showing 41 changed files with 2,500 additions and 4,150 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"typescript.tsdk": "node_modules/.pnpm/[email protected]/node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
35 changes: 35 additions & 0 deletions mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Image from 'next/image'
import Link from 'next/link'

const h1 = ({ children }) => (
<h1 className="text-gray-900 text-4xl font-extrabold mb-3.5 dark:text-white">
{children}
</h1>
)
const p = ({ children }) => (
<p className="text-gray-700 my-3 leading-relaxed dark:text-gray-400">
{children}
</p>
)
const a = ({ children, href }) => (
<Link
href={href}
className="underline dark:text-orange-300 dark:hover:text-orange-600 text-indigo-600 hover:text-indigo-900 cursor-pointer"
>
{children}
</Link>
)
const img = ({ src, alt }) => (
<Image
src={src}
alt={alt}
className="my-10 rounded-xl"
style={{
maxWidth: '100%',
height: 'auto',
}}
/>
)
export function useMDXComponents(components) {
return { h1, p, a, img, ...components }
}
13 changes: 10 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ const Config = async (phase, { defaultConfig }) => {
NEXT_PUBLIC_COMMIT_SHA: VERCEL_GIT_COMMIT_SHA,
},
images: {
domains: ['blog.kochie.io', 'holopin.io'],
domains: ['blog.kochie.io', 'holopin.io', 'assets.holopin.io'],
},
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
experimental: {
appDir: true,
mdxRs: true,
},
}

const withMDX = MDX({
Expand All @@ -40,7 +44,7 @@ const Config = async (phase, { defaultConfig }) => {
remarkPlugins: [],
rehypePlugins: [],
// If you use `MDXProvider`, uncomment the following line.
providerImportSource: '@mdx-js/react',
// providerImportSource: '@mdx-js/react',
// development: true,
},
})
Expand All @@ -50,7 +54,10 @@ const Config = async (phase, { defaultConfig }) => {
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
})

return withPWA(withMDX(config))
if (process.NODE_ENV === 'production') {
return withPWA(withMDX(config))
}
return withMDX(config)
}

export default Config
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"homepage": "https://github.com/kochie/me.kochie.io#readme",
"devDependencies": {
"@babel/core": "^7.21.0",
"@babel/parser": "^7.21.2",
"@babel/preset-react": "^7.18.6",
"@fortawesome/fontawesome-pro": "^6.3.0",
"@fortawesome/fontawesome-svg-core": "^6.3.0",
Expand Down
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions src/app/api/holopin/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NextResponse } from 'next/server'

export const config = {
runtime: 'edge',
}

export async function GET(request: Request) {
const { searchParams } = new URL(request.url)

// console.log(searchParams.get('username'))
const data = await fetch(
`https://www.holopin.io/api/auth/user/page?username=${searchParams.get(
'username'
)}`
).then((res) => res.json())
// console.log(data)

return NextResponse.json({ ...data })
}
40 changes: 40 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import Script from 'next/script'
import { config } from '@fortawesome/fontawesome-svg-core'
import '../assets/styles/global.css'
import 'tailwindcss/tailwind.css'
import '@fortawesome/fontawesome-svg-core/styles.css'
import { Source_Sans_Pro } from 'next/font/google'

config.autoAddCss = false

const sourceSansPro = Source_Sans_Pro({
subsets: ['latin'],
display: 'swap',
weight: ['400', '700'],
})

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body className={sourceSansPro.className}>
{children}
<Script
data-name="BMC-Widget"
data-cfasync="false"
src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js"
data-id="kochie"
data-description="Support me on Buy me a coffee!"
data-message=""
data-color="#FF5F5F"
data-position="Right"
data-x_margin="18"
data-y_margin="18"
/>
</body>
</html>
)
}
Loading

1 comment on commit 92244fb

@vercel
Copy link

@vercel vercel bot commented on 92244fb Mar 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

me.kochie.io – ./

mekochieio-kochie1.vercel.app
mekochieio-git-main-kochie1.vercel.app
me.kochie.io
robertkoch.me

Please sign in to comment.