Creates a listing page following the module pattern
Creates a listing page following the module pattern in src/app/modules/.
/create-list <module-name>/<entity-name>
Example: /create-list product/product, /create-list product/orders, /create-list account/users
When receiving the command, execute the following steps:
Create at src/app/modules/<module-name>/<entity-name>-listing.page.tsx
IMPORTANT: The component must have export default to work with lazy loading.
In src/app/modules/<module-name>/<module-name>.routes.ts, add the new route:
export const <Module>Routes = {
Base: '/<module>',
// ... existing routes
<Entity>Listing: '/<module>/<entity>-listing',
};
In src/app/modules/<module-name>/index.ts, add the lazy export:
export const Lazy<Entity>ListingPage = lazy(() => import(/* webpackPrefetch: true */ './<entity>-listing.page'));
In src/root.router.tsx:
import { Lazy<Entity>ListingPage } from '@app/modules/<module>';
import { <Module>Routes } from '@app/modules/<module>/<module>.routes';
<Route path={<Module>Routes.<Entity>Listing} element={<Lazy<Entity>ListingPage />} />
links array:export const links: MenuLink[] = [
// ... existing links
{ to: <Module>Routes.<Entity>Listing, content: '<Entities>', icon: <FaIcon.List /> },
];
IMPORTANT: The links array is passed to the <Layout> component and renders the sidebar menu. Always add the new page to the menu so the user can navigate to it.
Run npx tsc --noEmit to ensure there are no type errors.
| Component | Import | Usage |
|---|---|---|
Grid, Row, Col | @atomic/obj.grid | Responsive layout |
Card, Card.Item | @atomic/atm.card | Container |
H1, H2, Body, BodySecondary | @atomic/atm.typography | Text |
Table, THead, TBody, TR, TH, TD | @atomic/mol.table | Table |
Badge | @atomic/atm.badge | Status (colors: primary, secondary, success, danger, neutral) |
Button | @atomic/atm.button | Actions (variants: primary, secondary, cta, danger, neutral; props: link, outlined) |
Pagination | @atomic/atm.pagination | Pagination |
OrderBy | @atomic/mol.order-by | Column sorting |
Divider | @atomic/atm.divider | Separator |
src/atomic-samples/example-pages/create-list-example.page.tsxsrc/atomic-samples/example-pages/example-pages.routes.tssrc/atomic-samples/example-pages/index.tssrc/root.router.tsx