Skip to content

Commit

Permalink
Adding back About/ Export via MDX pages (#170)
Browse files Browse the repository at this point in the history
* Adding back basic pages
* Merge fix
* Fix TS error
* Run build before commit
  • Loading branch information
Kendra Gibbons authored Jan 7, 2022
1 parent 161a42f commit 2056cfe
Show file tree
Hide file tree
Showing 9 changed files with 675 additions and 94 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
. "$(dirname "$0")/_/husky.sh"
yarn lint
yarn test
yarn build
11 changes: 11 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
options: {
remarkPlugins: [],
rehypePlugins: [],
},
})
module.exports = withMDX({
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
})
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"@deck.gl/react": "^8.6.5",
"@headlessui/react": "^1.4.1",
"@math.gl/web-mercator": "^3.5.6",
"@mdx-js/loader": "^1.6.22",
"@next/mdx": "^12.0.7",
"@openbeta/remark-slate": "^1.8.2",
"@turf/bbox": "^6.5.0",
"@udecode/plate": "^9.1.2",
Expand Down
53 changes: 53 additions & 0 deletions src/components/StandardPageLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react'
import { MDXProvider } from '@mdx-js/react'
import Layout from './layout'
import SEOTags from './SeoTags'

export const Header = (props): JSX.Element => (
<header {...props}>
<h1 className='text-4xl font-bold font-sans tracking-tight my-4'>{props.text}</h1>
</header>
)
/**
* <h1> short code to be used in templates
*/
export const h1 = (props): JSX.Element => (
<h1 {...props} className='md-h1' />
)

export const h2 = (props): JSX.Element => (
<h2 {...props} className='md-h2' />
)

export const p = (props): JSX.Element => <p {...props} className='md-p' />

export const a = (props): JSX.Element => <a {...props} className='underline' />

export const ul = (props): JSX.Element => (
<ul {...props} className='list-inside list-disc' />
)

export const ol = (props): JSX.Element => (
<ol {...props} className='list-inside list-decimal' />
)

export const blockquote = (props): JSX.Element => (<blockquote {...props} className='border-l-4 border-gray-200 pl-6 my-6' />)

export const pre = (props): JSX.Element => (<pre {...props} className='font-mono text-sm rounded-xl bg-yellow-50 p-4' />)

const shortcodes = { Header, h1, h2, p, a, ol, ul, pre, blockquote }
export default ({ meta, children }): JSX.Element => {
const { title, keywords } = meta
return (
<Layout>
<>
<SEOTags keywords={keywords} title={title} />
<MDXProvider components={shortcodes}>
<div className='markdown mt-8'>
{children}
</div>
</MDXProvider>
</>
</Layout>
)
}
49 changes: 0 additions & 49 deletions src/components/layout.js

This file was deleted.

68 changes: 68 additions & 0 deletions src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React from 'react'
import Header from './header'
import Head from 'next/head'
import SeoTags from '../components/SeoTags'

interface LayoutProps {
layoutClz?: string
customClz?: string
children?: JSX.Element | JSX.Element[]
headerImage?: JSX.Element
}
function Layout ({ layoutClz = 'layout-default', customClz = '', children, headerImage }: LayoutProps): JSX.Element {
return (
<>
<Head>
<title>Climbing Route Catalog</title>
<meta name='description' content='Open license climbing route catalog' />
<link rel='icon' href='/favicon.ico' />
<link
href='/fonts/fonts.css'
rel='stylesheet'
/>
<SeoTags
keywords={['openbeta', 'rock climbing', 'climbing api']}
description='Climbing route catalog'
title='Home'
/>
</Head>

<div className={`main-container ${customClz}`}>
<Header />

{headerImage !== undefined && headerImage}

<main className={layoutClz}>{children}</main>

<footer className='mt-8 bg-custom-green'>
<nav className='flex justify-between max-w-4xl p-4 mx-auto text-sm md:p-8'>
<p className='text-white'>
A project by {' '}
<a
className='font-bold no-underline'
href='https://openbeta.io'
target='_blank'
rel='noopener noreferrer'
>
OpenBeta
</a>
</p>

<p>
<a
className='font-bold text-white no-underline'
href='https://github.com/OpenBeta/open-tacos'
target='_blank'
rel='noopener noreferrer'
>
GitHub
</a>
</p>
</nav>
</footer>
</div>
</>
)
}

export default Layout
17 changes: 11 additions & 6 deletions src/pages/about.md → src/pages/about.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: About the project
keywords:
- OpenBeta
- rock climbing
---
import StandardPageLayout from '../components/StandardPageLayout'

export const meta = {
title: 'About the project',
keywords: ['OpenBeta', 'rock climbing']
}

<StandardPageLayout meta={meta}>

# Welcome! 👋

OpenBeta is a grassroots initiative that brings climbers together for one common goal — to keep rock climbing information free and open for everyone.
Expand Down Expand Up @@ -72,3 +75,5 @@ OpenBeta is a volunteer effort. We encourage you to pitch in and join the team!
Thanks! ❤️ ❤️ ❤️

OpenBeta Team

</StandardPageLayout>
19 changes: 12 additions & 7 deletions src/pages/export.md → src/pages/export.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: OpenTacos data extracts
keywords:
- OpenBeta
- rock climbing api
---
import StandardPageLayout from '../components/StandardPageLayout'

export const meta = {
title: 'OpenTacos data extracts',
keywords: ['OpenBeta', 'rock climbing api']
}

<StandardPageLayout meta={meta}>

# OpenTacos Data Extracts

This page has weekly data extracts from the OpenTacos content catalog.
Expand All @@ -18,4 +21,6 @@ OpenTacos content (excluding photos) is licensed under [CreativeCommons Public D

## Technical details
- [Gitlab pipeline](https://gitlab.com/openbeta/exporter/-/pipeline_schedules)
- [Exporter code](https://github.com/OpenBeta/exporter)
- [Exporter code](https://github.com/OpenBeta/exporter)

</StandardPageLayout>
Loading

1 comment on commit 2056cfe

@vercel
Copy link

@vercel vercel bot commented on 2056cfe Jan 7, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.