2019-11-06 18:20:09 +04:00
|
|
|
import Error from "next/error";
|
|
|
|
import GuideLayout from 'layouts/guide';
|
|
|
|
import { serverOnlyProps } from 'lib/server';
|
|
|
|
import GuideHeader from 'components/guide-header';
|
|
|
|
import GuideBody from 'components/guide-body';
|
|
|
|
import ShareGuide from 'components/share-guide';
|
|
|
|
import GuideFooter from 'components/guide-footer';
|
|
|
|
import { getRequestedGuide } from "lib/guide";
|
2019-11-01 20:51:32 +04:00
|
|
|
|
|
|
|
const Guide = ({ guide }) => {
|
2019-11-06 18:20:09 +04:00
|
|
|
if (!guide) {
|
|
|
|
return <Error statusCode={404} />
|
|
|
|
}
|
|
|
|
|
2019-11-01 20:51:32 +04:00
|
|
|
return (
|
|
|
|
<GuideLayout>
|
2019-11-06 22:10:25 +04:00
|
|
|
<GuideHeader guide={guide} />
|
2019-11-02 12:45:15 +04:00
|
|
|
<GuideBody>
|
2019-11-06 18:20:09 +04:00
|
|
|
<guide.component />
|
2019-11-03 11:47:31 +04:00
|
|
|
<ShareGuide/>
|
2019-11-02 12:45:15 +04:00
|
|
|
</GuideBody>
|
2019-11-06 22:10:25 +04:00
|
|
|
<GuideFooter guide={guide} />
|
2019-11-01 20:51:32 +04:00
|
|
|
</GuideLayout>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
Guide.getInitialProps = serverOnlyProps(({ req }) => {
|
|
|
|
return {
|
2019-11-06 18:20:09 +04:00
|
|
|
guide: getRequestedGuide(req)
|
2019-11-01 20:51:32 +04:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2019-11-03 11:47:31 +04:00
|
|
|
export default Guide;
|