(react) add Pagination component

In order to create a DataGrid we first need a fully working pagination
component. It comes with multiples working examples in the documentation.
This commit is contained in:
Nathan Vasse
2023-02-20 16:27:37 +01:00
committed by NathanVss
parent 90feb4ba4a
commit 88e478d9f6
11 changed files with 584 additions and 7 deletions

15
apps/demo/src/App.tsx Normal file
View File

@@ -0,0 +1,15 @@
import { Button, usePagination, Pagination } from "@openfun/cunningham-react";
import React from "react";
import { tokens } from "./cunningham-tokens";
export const App = () => {
const pagination = usePagination({ defaultPage: 50, defaultPagesCount: 100 });
return (
<div className="center">
<h1 className="test">Cunningham Demo.</h1>
<Button>World best button.</Button>
<h3>Primary-500 color is {tokens.theme.colors["primary-500"]}</h3>
<Pagination {...pagination} />
</div>
);
};

View File

@@ -1,15 +1,13 @@
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.scss";
import { Button } from "@openfun/cunningham-react";
import { tokens } from "./cunningham-tokens";
import { CunninghamProvider } from "@openfun/cunningham-react";
import { App } from "./App";
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<div className="center">
<h1 className="test">Cunningham Demo.</h1>
<Button>World best button.</Button>
<h3>Primary-500 color is {tokens.theme.colors["primary-500"]}</h3>
</div>
<CunninghamProvider>
<App />
</CunninghamProvider>
</React.StrictMode>
);