mirror of
https://github.com/jambonz/next-static-site.git
synced 2025-12-19 04:47:44 +00:00
support plans and jambonz.cloud (#75)
* support plans and jambonz.cloud * update tests * further test fix * minor * change font-size of markdown text from 0.875 rem to 1rem
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
import Link from 'next/link';
|
||||
import { useRouter } from 'next/router';
|
||||
|
||||
import { nanoid } from 'nanoid';
|
||||
import { Icon, P } from '@jambonz/ui-kit';
|
||||
|
||||
import { getData } from '../src/lib/data';
|
||||
import { Icons } from '../src/components/icons';
|
||||
import Layout, { Hero } from '../src/components/layout';
|
||||
|
||||
function Regions({ data }) {
|
||||
const router = useRouter();
|
||||
const redirect = router.query.redirect;
|
||||
|
||||
return (
|
||||
<section className="regions">
|
||||
{data.regions.map((region) => {
|
||||
const href = (redirect === 'login') ? region.url : region.altUrl;
|
||||
const SvgIcon = Icons[region.icon];
|
||||
|
||||
return (
|
||||
<div key={nanoid()} className="wrap regions__wrap">
|
||||
<div className="regions__icon">
|
||||
<Icon subStyle={region.color}>
|
||||
<SvgIcon />
|
||||
</Icon>
|
||||
</div>
|
||||
<div className="regions__title">
|
||||
<P className={`med color--${region.color}`}>
|
||||
{region.title}
|
||||
</P>
|
||||
</div>
|
||||
<div className="regions__text">
|
||||
<P className="med">
|
||||
<Link href={href}>
|
||||
<a className="i" title={`jambonz ${region.title}`}>
|
||||
<span className="regions__text">{region.text}</span>
|
||||
<Icons.ExternalLink />
|
||||
</a>
|
||||
</Link>
|
||||
</P>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default function RegionsPage({ data }) {
|
||||
return (
|
||||
<Layout siteData={data.site}>
|
||||
<Hero data={data.regions.hero} altStyle="pink">
|
||||
<Regions data={data.regions} />
|
||||
</Hero>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getStaticProps() {
|
||||
const data = getData('regions');
|
||||
|
||||
return {
|
||||
props: {
|
||||
data,
|
||||
},
|
||||
};
|
||||
}
|
||||
39
pages/support/[[...slug]].js
Normal file
39
pages/support/[[...slug]].js
Normal file
@@ -0,0 +1,39 @@
|
||||
import Prism from 'prismjs';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import Layout from '../../src/components/layout';
|
||||
import Markdown from '../../src/components/markdown';
|
||||
import { getData, getMarkdown, getMarkdownPaths } from '../../src/lib/data';
|
||||
|
||||
export default function Support({ data, docs }) {
|
||||
useEffect(() => {
|
||||
setTimeout(() => Prism.highlightAll(), 0);
|
||||
});
|
||||
|
||||
return (
|
||||
<Layout siteData={data.site}>
|
||||
<Markdown scope="support" data={data['support']} docs={docs} />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const paths = getMarkdownPaths('support');
|
||||
|
||||
return {
|
||||
paths,
|
||||
fallback: false,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getStaticProps({ params }) {
|
||||
const data = getData('support');
|
||||
const docs = await getMarkdown('support', params.slug);
|
||||
|
||||
return {
|
||||
props: {
|
||||
data,
|
||||
docs,
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user