-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ceate base-integration package
- Loading branch information
1 parent
de2faf1
commit 965c83c
Showing
72 changed files
with
596 additions
and
851 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
import { Store } from '@component-controls/core'; | ||
import { getHomePages, DocHomePagesPath } from './docs-index-pages'; | ||
import { getDocPages, DocPagesPath } from './docs-pages'; | ||
import { getIndexPage, HomePageInfo } from './index-page'; | ||
|
||
export * from './docs-index-pages'; | ||
export * from './docs-pages'; | ||
export * from './index-page'; | ||
|
||
export type RoutePath = DocHomePagesPath & DocPagesPath & HomePageInfo; | ||
|
||
export const getRoutes = (store: Store): RoutePath[] => { | ||
const routes = []; | ||
//home page | ||
const index = getIndexPage(store) || {}; | ||
routes.push(index); | ||
//docs index pages | ||
const homePages = getHomePages(store); | ||
homePages.forEach(page => { | ||
routes.push(page); | ||
}); | ||
|
||
//document pages | ||
const docPages = getDocPages(store); | ||
docPages.forEach(page => { | ||
routes.push(page); | ||
}); | ||
return routes; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ module.exports = withStories({ | |
webpack5: true, | ||
}, | ||
configPath: '.config', | ||
distDir: 'dist', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
import React from 'react'; | ||
import { GetStaticProps, GetStaticPaths } from 'next'; | ||
import { | ||
DocHomeTemplate, | ||
NextLayout, | ||
store, | ||
getHomePagesPaths, | ||
getDocHomePage, | ||
} from '@component-controls/nextjs-plugin'; | ||
|
||
const DocHome: typeof DocHomeTemplate = props => <DocHomeTemplate {...props} />; | ||
const DocHome: typeof NextLayout = props => <NextLayout {...props} />; | ||
|
||
export const getStaticPaths: GetStaticPaths = async () => { | ||
return { paths: getHomePagesPaths(store), fallback: false }; | ||
}; | ||
|
||
export const getStaticProps: GetStaticProps = async ({ params }) => { | ||
const { doctype: basepath } = params as { doctype: string }; | ||
const page = getDocHomePage(store, basepath); | ||
const { type = null, docId = null, storyId = null } = page || {}; | ||
return { props: { docId, storyId, type } }; | ||
return { props: getDocHomePage(store, basepath) }; | ||
}; | ||
|
||
export default DocHome; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
import React from 'react'; | ||
import { GetStaticProps, GetStaticPaths } from 'next'; | ||
import { | ||
DocPageTemplate, | ||
NextLayout, | ||
store, | ||
getDocPagesPaths, | ||
getDocPage, | ||
} from '@component-controls/nextjs-plugin'; | ||
|
||
const DocPage: typeof DocPageTemplate = props => <DocPageTemplate {...props} />; | ||
const DocPage: typeof NextLayout = props => <NextLayout {...props} />; | ||
|
||
export const getStaticPaths: GetStaticPaths = async () => { | ||
return { paths: getDocPagesPaths(store), fallback: false }; | ||
}; | ||
|
||
export const getStaticProps: GetStaticProps = async ({ params }) => { | ||
const { doctype, docid } = params as { doctype: string; docid: string[] }; | ||
const page = getDocPage(store, doctype, docid); | ||
const { | ||
type = null, | ||
docId = null, | ||
storyId = null, | ||
category = null, | ||
activeTab = null, | ||
} = page || {}; | ||
return { props: { docId, type, storyId, category, activeTab } }; | ||
return { props: getDocPage(store, doctype, docid) }; | ||
}; | ||
|
||
export default DocPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import React from 'react'; | ||
import { GetStaticProps } from 'next'; | ||
import { | ||
DocPageTemplate, | ||
NextLayout, | ||
store, | ||
getIndexPage, | ||
} from '@component-controls/nextjs-plugin'; | ||
|
||
const HomePage: typeof DocPageTemplate = props => ( | ||
<DocPageTemplate {...props} /> | ||
); | ||
const HomePage: typeof NextLayout = props => <NextLayout {...props} />; | ||
|
||
export const getStaticProps: GetStaticProps = async () => { | ||
const homePage = getIndexPage(store); | ||
const { docId = null, type = null, storyId = null } = homePage; | ||
return { props: { docId, type, storyId } }; | ||
return { props: getIndexPage(store) }; | ||
}; | ||
|
||
export default HomePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ module.exports = withStories({ | |
webpack5: true, | ||
}, | ||
configPath: 'docs', | ||
distDir: 'dist', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
import React from 'react'; | ||
import { GetStaticProps, GetStaticPaths } from 'next'; | ||
import { | ||
DocHomeTemplate, | ||
NextLayout, | ||
store, | ||
getHomePagesPaths, | ||
getDocHomePage, | ||
} from '@component-controls/nextjs-plugin'; | ||
|
||
const DocHome: typeof DocHomeTemplate = props => <DocHomeTemplate {...props} />; | ||
const DocHome: typeof NextLayout = props => <NextLayout {...props} />; | ||
|
||
export const getStaticPaths: GetStaticPaths = async () => { | ||
return { paths: getHomePagesPaths(store), fallback: false }; | ||
}; | ||
|
||
export const getStaticProps: GetStaticProps = async ({ params }) => { | ||
const { doctype: basepath } = params as { doctype: string }; | ||
const page = getDocHomePage(store, basepath); | ||
const { type = null, docId = null, storyId = null } = page || {}; | ||
return { props: { docId, storyId, type } }; | ||
return { props: getDocHomePage(store, basepath) }; | ||
}; | ||
|
||
export default DocHome; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
import React from 'react'; | ||
import { GetStaticProps, GetStaticPaths } from 'next'; | ||
import { | ||
DocPageTemplate, | ||
NextLayout, | ||
store, | ||
getDocPagesPaths, | ||
getDocPage, | ||
} from '@component-controls/nextjs-plugin'; | ||
|
||
const DocPage: typeof DocPageTemplate = props => <DocPageTemplate {...props} />; | ||
const DocPage: typeof NextLayout = props => <NextLayout {...props} />; | ||
|
||
export const getStaticPaths: GetStaticPaths = async () => { | ||
return { paths: getDocPagesPaths(store), fallback: false }; | ||
}; | ||
|
||
export const getStaticProps: GetStaticProps = async ({ params }) => { | ||
const { doctype, docid } = params as { doctype: string; docid: string[] }; | ||
const page = getDocPage(store, doctype, docid); | ||
const { | ||
type = null, | ||
docId = null, | ||
storyId = null, | ||
category = null, | ||
activeTab = null, | ||
} = page || {}; | ||
return { props: { docId, type, storyId, category, activeTab } }; | ||
return { props: getDocPage(store, doctype, docid) }; | ||
}; | ||
|
||
export default DocPage; |
Oops, something went wrong.