webpanel-admin
v0.3.32
Published
Webpanel Administration library for creating various admin interfaces.
Downloads
20
Readme
admin
Webpanel Administration library for creating various admin interfaces.
Getting started
npx create-react-app --template typescript --use-npm my-app
cd my-app
npm add [email protected] [email protected] webpanel-admin webpanel-antd webpanel-data [email protected] i18next react-i18next
Update src/App.tsx
to following content:
import * as React from "react";
import { AdminLayout, Entity } from "webpanel-admin";
import { DataSource, RestConnector } from "webpanel-data";
// DataSource
const connector = new RestConnector();
export const api = new DataSource(
"api",
connector,
"https://jsonplaceholder.typicode.com/"
);
// Entity config
const todo = new Entity({
name: "Todo",
dataSource: api,
})
.stringField("name")
.booleanField("completed");
// Admin initialization
const App = () => {
return (
<AdminLayout
logout={() => {
// do logout
}}
logoURL="/logo.svg"
logoCollapsedURL="/logo.svg"
menu={{ theme: "dark" }}
entities={() => [todo]}
/>
);
};
export default App;
Start the application:
npm start
If You want to see the recommended project structure, please see Example project