Skip to content

Commit 5511968

Browse files
committed
feat: add layout package with PageHeader component and configuration files
1 parent 421ba06 commit 5511968

File tree

7 files changed

+177
-2
lines changed

7 files changed

+177
-2
lines changed

.github/prompts/component.prompt.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@
44
**Task:** Create reusable, schema-driven UI widgets for the ObjectStack Design System.
55
**Environment:** You are working in an Application or Plugin codebase. You consume `@objectstack/spec` types to build compatible components.
66

7+
## 0. Architectural Strategy (Strict)
8+
9+
**❌ Do NOT create a package for every component.**
10+
**✅ Group by Dependency Weight:**
11+
12+
1. **Atoms (@object-ui/components):**
13+
* Shadcn Primitives, Icons, Buttons.
14+
* Zero business logic.
15+
* Zero heavy 3rd-party deps.
16+
17+
2. **Fields (@object-ui/fields):**
18+
* Standard Input/Display widgets (Text, Number, Date, Select).
19+
* Must implement `FieldWidgetProps`.
20+
21+
3. **Layouts & Patterns (@object-ui/layout):**
22+
* Page structures (Sidebar, Header, AppLauncher).
23+
* Routing-aware components.
24+
25+
4. **Plugins (@object-ui/plugin-*):**
26+
* **Heavy Widgets Only.**
27+
* If it adds >50KB bundle size, it's a plugin.
28+
* Examples: `plugin-map` (Leaflet), `plugin-code` (Monaco), `plugin-grid` (AgGrid/TanStack).
29+
730
---
831

932
## 1. Component Categories

packages/layout/package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@object-ui/layout",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"main": "dist/index.umd.cjs",
6+
"module": "dist/index.js",
7+
"types": "dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.js",
12+
"require": "./dist/index.umd.cjs"
13+
}
14+
},
15+
"scripts": {
16+
"build": "vite build",
17+
"lint": "eslint ."
18+
},
19+
"dependencies": {
20+
"@object-ui/components": "workspace:*",
21+
"@object-ui/core": "workspace:*",
22+
"@object-ui/types": "workspace:*",
23+
"clsx": "^2.1.0",
24+
"lucide-react": "^0.563.0",
25+
"react": "^18.2.0",
26+
"react-dom": "^18.2.0",
27+
"tailwind-merge": "^2.2.1"
28+
},
29+
"peerDependencies": {
30+
"react": "^18.0.0 || ^19.0.0",
31+
"react-dom": "^18.0.0 || ^19.0.0"
32+
},
33+
"devDependencies": {
34+
"@vitejs/plugin-react": "^4.2.1",
35+
"vite": "^7.3.1",
36+
"vite-plugin-dts": "^4.5.4"
37+
}
38+
}

packages/layout/src/PageHeader.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import { cn } from '@object-ui/components';
3+
4+
export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
5+
title: string;
6+
description?: string;
7+
action?: React.ReactNode;
8+
}
9+
10+
export function PageHeader({
11+
title,
12+
description,
13+
action,
14+
className,
15+
children,
16+
...props
17+
}: PageHeaderProps) {
18+
return (
19+
<div className={cn("flex flex-col gap-4 pb-4 md:pb-8", className)} {...props}>
20+
<div className="flex items-center justify-between gap-4">
21+
<div className="flex flex-col gap-1">
22+
<h1 className="text-2xl font-bold tracking-tight md:text-3xl">{title}</h1>
23+
{description && <p className="text-sm text-muted-foreground">{description}</p>}
24+
</div>
25+
{action && <div className="flex items-center gap-2">{action}</div>}
26+
</div>
27+
{children}
28+
</div>
29+
);
30+
}

packages/layout/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* ObjectUI Layout
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*/
5+
6+
export * from './PageHeader';

packages/layout/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"jsx": "react-jsx"
6+
},
7+
"include": ["src"]
8+
}

packages/layout/vite.config.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { defineConfig } from 'vite';
2+
import react from '@vitejs/plugin-react';
3+
import dts from 'vite-plugin-dts';
4+
import { resolve } from 'path';
5+
6+
export default defineConfig({
7+
plugins: [
8+
react(),
9+
dts({
10+
insertTypesEntry: true,
11+
include: ['src'],
12+
}),
13+
],
14+
build: {
15+
lib: {
16+
entry: resolve(__dirname, 'src/index.ts'),
17+
name: 'ObjectUILayout',
18+
fileName: 'index',
19+
},
20+
rollupOptions: {
21+
external: [
22+
'react',
23+
'react-dom',
24+
'@object-ui/components',
25+
'@object-ui/core',
26+
'@object-ui/types',
27+
'clsx',
28+
'tailwind-merge',
29+
'lucide-react'
30+
],
31+
},
32+
},
33+
});

pnpm-lock.yaml

Lines changed: 39 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)