ui-next: add sample plugin

This commit is contained in:
Baoshuo committed 2026-05-10 01:12:47 +08:00
1 parent ad49272dca
commit 504b9639b5
4 files changed
+17 -10

No files matched your search

@@ -0,0 +1,6 @@
{
"name": "@hydrooj/ui-next-plugin-sample",
"dependencies": {
"@hydrooj/ui-next": "workspace:*"
}
}
@@ -0,0 +1,4 @@
export default function BeforeComponent() {
console.log('before app');
return <div>before app via @hydrooj/ui-next-plugin-sample</div>;
}
@@ -0,0 +1,6 @@
import type { PluginAPI } from '@hydrooj/ui-next';
import BeforeComponent from './before';
export function setup(api: PluginAPI) {
api.before('page:app', BeforeComponent);
}
+1 -10
View File
@@ -1,6 +1,6 @@
import { Link } from './components/link';
import { usePageData } from './context/page-data';
import { before, defineSlot } from './registry';
import { defineSlot } from './registry';
const AppInner = defineSlot('page:app', () => {
const data = usePageData();
@@ -15,13 +15,4 @@ const AppInner = defineSlot('page:app', () => {
);
});
before('page:app', () => {
console.log('before app');
return (
<>
<div>before app</div>
</>
);
});
export default AppInner;