diff --git a/examples/with-config/README.md b/examples/with-config/README.md new file mode 100644 index 00000000000..6231eacdcfa --- /dev/null +++ b/examples/with-config/README.md @@ -0,0 +1,50 @@ +# with-config + +## Installation + +Install the application dependencies by running: + +```sh +npm install +# or +yarn install +``` + +## Development + +Start the application in development mode by running: + +```sh +npm run dev +# or +yarn dev +``` + +## Production + +Build the application in production mode by running: + +```sh +npm run build +# or +yarn build +``` + +## DataProvider + +The included data provider use [FakeREST](https://github.com/marmelab/fakerest) to simulate a backend. +You'll find a `data.json` file in the `src` directory that includes some fake data for testing purposes. + +It includes two resources, posts and comments. +Posts have the following properties: `id`, `title` and `content`. +Comments have the following properties: `id`, `post_id` and `content`. + +## Authentication + +The included auth provider should only be used for development and test purposes. +You'll find a `users.json` file in the `src` directory that includes the users you can use. + +You can sign in to the application with the following usernames and password: +- janedoe / password +- johndoe / password + diff --git a/examples/with-config/index.html b/examples/with-config/index.html new file mode 100644 index 00000000000..26018ebc157 --- /dev/null +++ b/examples/with-config/index.html @@ -0,0 +1,125 @@ + + + + + + + + + with-config + + + + + + + +
+
+
Loading...
+
+
+ + + diff --git a/examples/with-config/package.json b/examples/with-config/package.json new file mode 100644 index 00000000000..06bf10a48c1 --- /dev/null +++ b/examples/with-config/package.json @@ -0,0 +1,24 @@ +{ + "name": "with-config", + "private": true, + "scripts": { + "dev": "vite", + "build": "vite build", + "serve": "vite preview", + "type-check": "tsc --noEmit" + }, + "dependencies": { + "ra-data-fakerest": "^4.9.2", + "react": "^18.2.0", + "react-admin": "^4.9.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/node": "^18.16.1", + "@types/react": "^18.0.22", + "@types/react-dom": "^18.0.7", + "@vitejs/plugin-react": "^2.2.0", + "typescript": "^4.6.4", + "vite": "^3.2.0" + } +} diff --git a/examples/with-config/public/favicon.ico b/examples/with-config/public/favicon.ico new file mode 100644 index 00000000000..f9222554e6c Binary files /dev/null and b/examples/with-config/public/favicon.ico differ diff --git a/examples/with-config/public/manifest.json b/examples/with-config/public/manifest.json new file mode 100644 index 00000000000..0b29eca21ce --- /dev/null +++ b/examples/with-config/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "with-config", + "name": "{{name}}", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + } + ], + "start_url": "./index.html", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/examples/with-config/src/App.tsx b/examples/with-config/src/App.tsx new file mode 100644 index 00000000000..7eb96a1c0a4 --- /dev/null +++ b/examples/with-config/src/App.tsx @@ -0,0 +1,58 @@ +import { + Admin, + ListGuesser, + EditGuesser, + ShowGuesser, + CardContentInner, + Button, +} from 'react-admin'; +import { Link } from 'react-router-dom'; +import { dataProvider } from './dataProvider'; +import { authProvider } from './authProvider'; + +export const App = () => ( + ({ + posts: { + edit: EditGuesser, + list: ListGuesser, + routes: [ + { + path: 'all/*', + element: , + }, + { + path: '*', + element: ( + + Posts Dashboard +
+