-
-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into visually-hidden-utility-class
- Loading branch information
Showing
333 changed files
with
9,873 additions
and
5,286 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,4 @@ docs/_build/ | |
/.tool-versions | ||
docs/source/news | ||
|
||
.turbo | ||
.parcel-cache/ | ||
tsconfig.tsbuildinfo |
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* This is intended to be a basic starting point for linting in your app. | ||
* It relies on recommended configs out of the box for simplicity, but you can | ||
* and should modify this configuration to best suit your team's needs. | ||
*/ | ||
|
||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
}, | ||
|
||
// Base config | ||
extends: ['eslint:recommended'], | ||
|
||
overrides: [ | ||
// React | ||
{ | ||
files: ['**/*.{js,jsx,ts,tsx}'], | ||
plugins: ['react', 'jsx-a11y'], | ||
extends: [ | ||
'plugin:react/recommended', | ||
'plugin:react/jsx-runtime', | ||
'plugin:react-hooks/recommended', | ||
'plugin:jsx-a11y/recommended', | ||
], | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
formComponents: ['Form'], | ||
linkComponents: [ | ||
{ name: 'Link', linkAttribute: 'to' }, | ||
{ name: 'NavLink', linkAttribute: 'to' }, | ||
], | ||
}, | ||
}, | ||
|
||
// Typescript | ||
{ | ||
files: ['**/*.{ts,tsx}'], | ||
plugins: ['@typescript-eslint', 'import'], | ||
parser: '@typescript-eslint/parser', | ||
settings: { | ||
'import/internal-regex': '^~/', | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.ts', '.tsx'], | ||
}, | ||
typescript: { | ||
alwaysTryTypes: true, | ||
}, | ||
}, | ||
}, | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
], | ||
}, | ||
|
||
// Node | ||
{ | ||
files: ['.eslintrc.js'], | ||
env: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
}; |
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,7 @@ | ||
node_modules | ||
|
||
/.cache | ||
/build | ||
.env | ||
.react-router | ||
.registry.loader.js |
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,30 @@ | ||
# Plone on React Router 7 | ||
|
||
This is a proof of concept of a [React Router](https://reactrouter.com/dev/docs) app, using the `@plone/*` libraries. | ||
This is intended to serve as both a playground for the development of both packages and as a demo of Plone using Remix. | ||
|
||
> [!WARNING] | ||
> This package or app is experimental. | ||
> The community offers no support whatsoever for it. | ||
> Breaking changes may occur without notice. | ||
## Development | ||
|
||
To start, from the root of the monorepo, issue the following commands. | ||
|
||
```shell | ||
pnpm install | ||
pnpm --filter plone-remix run dev | ||
``` | ||
|
||
Then start the Plone backend. | ||
|
||
% TODO MAKEFILE | ||
```shell | ||
make backend-docker-start | ||
``` | ||
|
||
|
||
## About this app | ||
|
||
- [Remix Docs](https://remix.run/docs/en/main) |
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,8 @@ | ||
import ploneClient from '@plone/client'; | ||
import config from '@plone/registry'; | ||
|
||
const cli = ploneClient.initialize({ | ||
apiPath: config.settings.apiPath, | ||
}); | ||
|
||
export { cli as ploneClient }; |
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,15 @@ | ||
import config from '@plone/registry'; | ||
import { blocksConfig, slate } from '@plone/blocks'; | ||
|
||
const settings = { | ||
apiPath: 'http://localhost:3000', | ||
slate, | ||
}; | ||
|
||
// @ts-expect-error We need to fix typing | ||
config.set('settings', settings); | ||
|
||
// @ts-expect-error We need to fix typing | ||
config.set('blocks', { blocksConfig }); | ||
|
||
export default config; |
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,98 @@ | ||
import { useState } from 'react'; | ||
import { | ||
Links, | ||
Meta, | ||
Outlet, | ||
Scripts, | ||
ScrollRestoration, | ||
useHref, | ||
useLocation, | ||
useNavigate, | ||
useParams, | ||
} from 'react-router'; | ||
import type { LinksFunction } from 'react-router'; | ||
|
||
import { QueryClient } from '@tanstack/react-query'; | ||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; | ||
import PloneClient from '@plone/client'; | ||
import { PloneProvider } from '@plone/providers'; | ||
import { flattenToAppURL } from './utils'; | ||
import config from '@plone/registry'; | ||
import './config'; | ||
|
||
import '@plone/components/dist/basic.css'; | ||
|
||
function useHrefLocal(to: string) { | ||
return useHref(flattenToAppURL(to)); | ||
} | ||
|
||
export const links: LinksFunction = () => [ | ||
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }, | ||
{ | ||
rel: 'preconnect', | ||
href: 'https://fonts.gstatic.com', | ||
crossOrigin: 'anonymous', | ||
}, | ||
{ | ||
rel: 'stylesheet', | ||
href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap', | ||
}, | ||
]; | ||
|
||
export function Layout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body> | ||
{children} | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export default function App() { | ||
const [queryClient] = useState( | ||
() => | ||
new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
// With SSR, we usually want to set some default staleTime | ||
// above 0 to avoid refetching immediately on the client | ||
staleTime: 60 * 1000, | ||
}, | ||
}, | ||
}), | ||
); | ||
|
||
const [ploneClient] = useState(() => | ||
PloneClient.initialize({ | ||
apiPath: config.settings.apiPath, | ||
}), | ||
); | ||
|
||
const RRNavigate = useNavigate(); | ||
const navigate = (to: string) => { | ||
return RRNavigate(flattenToAppURL(to)); | ||
}; | ||
|
||
return ( | ||
<PloneProvider | ||
ploneClient={ploneClient} | ||
queryClient={queryClient} | ||
useLocation={useLocation} | ||
useParams={useParams} | ||
useHref={useHrefLocal} | ||
navigate={navigate} | ||
> | ||
<Outlet /> | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
</PloneProvider> | ||
); | ||
} |
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,7 @@ | ||
import type { RouteConfig } from '@react-router/dev/routes'; | ||
import { index, route } from '@react-router/dev/routes'; | ||
|
||
export const routes: RouteConfig = [ | ||
index('routes/home.tsx'), | ||
route('*', 'routes/$.tsx'), | ||
]; |
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,2 @@ | ||
import Content, { loader } from './home'; | ||
export { loader, Content as default }; |
Oops, something went wrong.