-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve docs. Introduce generic loader component. Use Formik using ho…
…ok instead of components for more flexibility.
- Loading branch information
Showing
11 changed files
with
152 additions
and
115 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
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
5 changes: 5 additions & 0 deletions
5
...nerator/templates/react-frontend/[artifactId]-web/src/components/LoadingIndicator.tsx.peb
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { useEffect, useState } from 'react' | ||
|
||
export const LoadingIndicator = () => ( | ||
<div>Loading...</div> | ||
) |
26 changes: 26 additions & 0 deletions
26
...tor/templates/react-frontend/[artifactId]-web/src/components/layout/DefaultLayout.tsx.peb
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Link from 'next/link' | ||
|
||
export interface Breadcrumb { | ||
label: string, | ||
href: string, | ||
} | ||
|
||
export interface DefaultLayoutProps { | ||
breadcrumbs?: Breadcrumb[], | ||
children?: ReactNode, | ||
} | ||
|
||
export const DefaultLayout(props: DefaultLayoutProps) { | ||
return ( | ||
<> | ||
{props.breadcrumbs && <ul> | ||
{props.breadcrumbs.map((breadcrumb, i) => ( | ||
<div key={i}> | ||
<Link href={breadcrumb.href}>{breadcrumb.label}</Link} | ||
</div> | ||
)} | ||
</ul>} | ||
{children} | ||
</> | ||
) | ||
} |
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
45 changes: 45 additions & 0 deletions
45
pkg/generator/templates/react-frontend/[artifactId]-web/src/pages/[underscore]app.tsx.peb
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ResetUrqlClientContext } from '@lib/reset-urql-client-context' | ||
import { withUrqlClient } from 'next-urql' | ||
import type { AppProps } from 'next/app' | ||
import Head from 'next/head' | ||
import { | ||
cacheExchange, | ||
fetchExchange, | ||
mapExchange | ||
} from 'urql' | ||
|
||
function App({ | ||
Component, | ||
pageProps, | ||
resetUrqlClient, | ||
}: AppProps & { resetUrqlClient: () => void }) { | ||
return ( | ||
<> | ||
<Head> | ||
<title>{{ artifactId }}</title> | ||
<meta name="description" content="{{ artifactId }}" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
</Head> | ||
<ResetUrqlClientContext.Provider value={resetUrqlClient}> | ||
<Component {...pageProps} /> | ||
</ResetUrqlClientContext.Provider> | ||
</> | ||
) | ||
} | ||
|
||
export default withUrqlClient((ssrExchange) => { | ||
const exchanges = [ | ||
cacheExchange, | ||
mapExchange({}), | ||
ssrExchange, | ||
fetchExchange, | ||
] | ||
return { | ||
url: '/graphql', | ||
exchanges, | ||
fetchOptions: { | ||
credentials: 'include', | ||
}, | ||
requestPolicy: 'cache-and-network', | ||
} | ||
})(App) |
Oops, something went wrong.