Skip to content

Commit

Permalink
fix: tags url path and nextjs template pages
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 9, 2021
1 parent 50dab81 commit ca1c6c0
Show file tree
Hide file tree
Showing 23 changed files with 149 additions and 268 deletions.
26 changes: 4 additions & 22 deletions examples/nextjs/pages/[doctype].tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
import React, { FC } from 'react';
import React from 'react';
import { GetStaticProps, GetStaticPaths } from 'next';
import { DocType, defDocType } from '@component-controls/core';
import { DocumentHomePage } from '@component-controls/app';
import {
Layout,
DocHomeTemplate,
store,
getHomePagesPaths,
getDocHomePage,
} from '@component-controls/nextjs-plugin';

interface PageListProps {
type: DocType;
docId?: string;
storyId?: string;
}

const DocHomeTemplate: FC<PageListProps> = ({
type = defDocType,
docId,
storyId,
}) => {
return (
<Layout docId={docId} storyId={storyId}>
<DocumentHomePage type={type} />
</Layout>
);
};
const DocHome: typeof DocHomeTemplate = props => <DocHomeTemplate {...props} />;

export const getStaticPaths: GetStaticPaths = async () => {
return { paths: getHomePagesPaths(store), fallback: false };
Expand All @@ -38,4 +20,4 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
return { props: { docId, storyId, type } };
};

export default DocHomeTemplate;
export default DocHome;
30 changes: 4 additions & 26 deletions examples/nextjs/pages/[doctype]/[...docid].tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
import React, { FC } from 'react';
import React from 'react';
import { GetStaticProps, GetStaticPaths } from 'next';
import { DocPage } from '@component-controls/app';
import { DocType } from '@component-controls/core';
import {
Layout,
DocPageTemplate,
store,
getDocPagesPaths,
getDocPage,
} from '@component-controls/nextjs-plugin';

interface DocPageProps {
docId?: string;
storyId?: string;
type: DocType;
activeTab?: string;
category?: string;
}

const DocPageTemplate: FC<DocPageProps> = ({
docId,
storyId,
type,
category,
activeTab,
}) => {
return (
<Layout docId={docId} storyId={storyId} activeTab={activeTab}>
<DocPage type={type} category={category} />
</Layout>
);
};
const DocPage: typeof DocPageTemplate = props => <DocPageTemplate {...props} />;

export const getStaticPaths: GetStaticPaths = async () => {
return { paths: getDocPagesPaths(store), fallback: false };
Expand All @@ -48,4 +26,4 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
return { props: { docId, type, storyId, category, activeTab } };
};

export default DocPageTemplate;
export default DocPage;
26 changes: 9 additions & 17 deletions examples/nextjs/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import React, { FC } from 'react';
import React from 'react';
import { GetStaticProps } from 'next';
import { DocType, defDocType } from '@component-controls/core';
import { DocPage } from '@component-controls/app';
import { Layout, store, getIndexPage } from '@component-controls/nextjs-plugin';
import {
DocPageTemplate,
store,
getIndexPage,
} from '@component-controls/nextjs-plugin';

interface PageListProps {
type: DocType;
docId?: string;
storyId?: string;
}

const HomePage: FC<PageListProps> = ({ type = defDocType, docId, storyId }) => {
return (
<Layout docId={docId} storyId={storyId}>
<DocPage type={type} />
</Layout>
);
};
const HomePage: typeof DocPageTemplate = props => (
<DocPageTemplate {...props} />
);

export const getStaticProps: GetStaticProps = async () => {
const homePage = getIndexPage(store);
Expand Down
26 changes: 4 additions & 22 deletions examples/simple/pages/[doctype].tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
import React, { FC } from 'react';
import React from 'react';
import { GetStaticProps, GetStaticPaths } from 'next';
import { DocType, defDocType } from '@component-controls/core';
import { DocumentHomePage } from '@component-controls/app';
import {
Layout,
DocHomeTemplate,
store,
getHomePagesPaths,
getDocHomePage,
} from '@component-controls/nextjs-plugin';

interface PageListProps {
type: DocType;
docId?: string;
storyId?: string;
}

const DocHomeTemplate: FC<PageListProps> = ({
type = defDocType,
docId,
storyId,
}) => {
return (
<Layout docId={docId} storyId={storyId}>
<DocumentHomePage type={type} />
</Layout>
);
};
const DocHome: typeof DocHomeTemplate = props => <DocHomeTemplate {...props} />;

export const getStaticPaths: GetStaticPaths = async () => {
return { paths: getHomePagesPaths(store), fallback: false };
Expand All @@ -38,4 +20,4 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
return { props: { docId, storyId, type } };
};

export default DocHomeTemplate;
export default DocHome;
30 changes: 4 additions & 26 deletions examples/simple/pages/[doctype]/[...docid].tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
import React, { FC } from 'react';
import React from 'react';
import { GetStaticProps, GetStaticPaths } from 'next';
import { DocPage } from '@component-controls/app';
import { DocType } from '@component-controls/core';
import {
Layout,
DocPageTemplate,
store,
getDocPagesPaths,
getDocPage,
} from '@component-controls/nextjs-plugin';

interface DocPageProps {
docId?: string;
storyId?: string;
type: DocType;
activeTab?: string;
category?: string;
}

const DocPageTemplate: FC<DocPageProps> = ({
docId,
storyId,
type,
category,
activeTab,
}) => {
return (
<Layout docId={docId} storyId={storyId} activeTab={activeTab}>
<DocPage type={type} category={category} />
</Layout>
);
};
const DocPage: typeof DocPageTemplate = props => <DocPageTemplate {...props} />;

export const getStaticPaths: GetStaticPaths = async () => {
return { paths: getDocPagesPaths(store), fallback: false };
Expand All @@ -48,4 +26,4 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
return { props: { docId, type, storyId, category, activeTab } };
};

export default DocPageTemplate;
export default DocPage;
26 changes: 9 additions & 17 deletions examples/simple/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import React, { FC } from 'react';
import React from 'react';
import { GetStaticProps } from 'next';
import { DocType, defDocType } from '@component-controls/core';
import { DocPage } from '@component-controls/app';
import { Layout, store, getIndexPage } from '@component-controls/nextjs-plugin';
import {
DocPageTemplate,
store,
getIndexPage,
} from '@component-controls/nextjs-plugin';

interface PageListProps {
type: DocType;
docId?: string;
storyId?: string;
}

const HomePage: FC<PageListProps> = ({ type = defDocType, docId, storyId }) => {
return (
<Layout docId={docId} storyId={storyId}>
<DocPage type={type} />
</Layout>
);
};
const HomePage: typeof DocPageTemplate = props => (
<DocPageTemplate {...props} />
);

export const getStaticProps: GetStaticProps = async () => {
const homePage = getIndexPage(store);
Expand Down
20 changes: 3 additions & 17 deletions examples/starter/pages/root.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
import React, { FC } from 'react';
import React from 'react';
import { GetStaticProps } from 'next';
import { DocType, defDocType } from '@component-controls/core';
import { DocPage } from '@component-controls/app';
import { Layout, store, getIndexPage } from '@component-controls/nextjs-plugin';
import { DocPageTemplate, store, getIndexPage } from '@component-controls/nextjs-plugin';

interface PageListProps {
type: DocType;
docId?: string;
storyId?: string;
}

const HomePage: FC<PageListProps> = ({ type = defDocType, docId, storyId }) => {
return (
<Layout docId={docId} storyId={storyId}>
<DocPage type={type} />
</Layout>
);
};
const HomePage: typeof DocPageTemplate = props => <DocPageTemplate {...props} />;

export const getStaticProps: GetStaticProps = async () => {
const homePage = getIndexPage(store);
Expand Down
23 changes: 3 additions & 20 deletions examples/starter/pages/root/[doctype].tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
import React, { FC } from 'react';
import { GetStaticProps, GetStaticPaths } from 'next';
import { DocType, defDocType } from '@component-controls/core';
import { DocumentHomePage } from '@component-controls/app';
import {
Layout,
DocHomeTemplate,
store,
getHomePagesPaths,
getDocHomePage,
} from '@component-controls/nextjs-plugin';

interface PageListProps {
type: DocType;
docId?: string;
storyId?: string;
}
const DocHome: typeof DocHomeTemplate = props => <DocHomeTemplate {...props} />;

const DocHomeTemplate: FC<PageListProps> = ({
type = defDocType,
docId,
storyId,
}) => {
return (
<Layout docId={docId} storyId={storyId}>
<DocumentHomePage type={type} />
</Layout>
);
};

export const getStaticPaths: GetStaticPaths = async () => {
return { paths: getHomePagesPaths(store), fallback: false };
Expand All @@ -38,4 +21,4 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
return { props: { docId, storyId, type } };
};

export default DocHomeTemplate;
export default DocHome;
28 changes: 4 additions & 24 deletions examples/starter/pages/root/[doctype]/[...docid].tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
import React, { FC } from 'react';
import { GetStaticProps, GetStaticPaths } from 'next';
import { DocPage } from '@component-controls/app';
import { DocType } from '@component-controls/core';
import {
Layout,
DocPageTemplate,
store,
getDocPagesPaths,
getDocPage,
} from '@component-controls/nextjs-plugin';

interface DocPageProps {
docId?: string;
storyId?: string;
type: DocType;
activeTab?: string;
category?: string;
}

const DocPageTemplate: FC<DocPageProps> = ({
docId,
storyId,
type,
category,
activeTab,
}) => {
return (
<Layout docId={docId} storyId={storyId} activeTab={activeTab}>
<DocPage type={type} category={category} />
</Layout>
);
};

const DocPage: typeof DocPageTemplate = props => <DocPageTemplate {...props} />;

export const getStaticPaths: GetStaticPaths = async () => {
return { paths: getDocPagesPaths(store), fallback: false };
Expand All @@ -48,4 +28,4 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
return { props: { docId, type, storyId, category, activeTab } };
};

export default DocPageTemplate;
export default DocPage;
Loading

0 comments on commit ca1c6c0

Please sign in to comment.