Files
next-static-site/pages/regions.js
Brandon Lee Kitajchuk e3cd0edeb6 Initial refactor of jambonz-ui package library (#39)
* Initial refactor of jambonz-ui package library

* Delete public/fonts directory

* Jambonz UI test-app and some refinements

* next lint

* working on jambonz ui docs

* Update package.json

* Update package.json

* Update package.json

* Create package.json

* typescript

* Update components.tsx

* Update components.tsx

* Update utils.ts

* Update icons.ts

* Update components.tsx

* Update components.tsx

* Update icons.ts

* Update components.tsx

* Update _icons.scss

* Update components.tsx

* Update components.tsx

* fix some thangs and compile all

* wrap up the docs

* Update tsconfig.json

* icons refactor

* refine docs

* update readmes

* update readme

* fix props interfaces and test in TS app

* Update components.tsx

* button up some things

* change package name...

* include readme in pkg dist

* use published package
2022-07-01 10:57:32 -07:00

68 lines
1.8 KiB
JavaScript

import Link from 'next/link';
import { useRouter } from 'next/router';
import { nanoid } from 'nanoid';
import { Icon, P } from 'jambonz-ui';
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} mainStyle="fill">
<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,
},
};
}