Skip to content

Commit

Permalink
upd: qAppLayout of runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX committed Nov 23, 2023
1 parent c11f8c7 commit 3e0fac3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 35 deletions.
45 changes: 45 additions & 0 deletions packages/runtime/src/components/appLayout.r.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/// <reference types="vite/client" />
import { ComponentContext, Content, OutputComponent } from "refina";
import QuasiRuntime from "../plugin";
import { Direction, component, content, textProp } from "../types";

export default component({
displayName: () => "App layout",
contents: {
title: content("title", "as-primary"),
topBar: content("top bar", "as-socket"),
main: content("main", "as-socket", Direction.BOTTOM),
},
props: {
class: textProp("class"),
},
});

export interface AppLayoutProps {
class: string;
title: string;
topBar: Content;
main: Content;
}

@QuasiRuntime.outputComponent("qAppLayout")
export class QAppLayout extends OutputComponent {
main(_: ComponentContext, props: AppLayoutProps): void {
_.$cls(props.class);
_.mdTopAppBar(_ => {
_.mdTopAppBarTitle(
_ =>
_.$css`user-select:none;text-decoration:none;color:inherit` &&
_._a({ href: window.__QUASI_PREVIEW__ ? "" : import.meta.env.BASE_URL }, props.title),
);
_.embed(props.topBar);
});
_.mdLayoutMain(props.main);
}
}

declare module "refina" {
interface OutputComponents {
qAppLayout: QAppLayout;
}
}
32 changes: 0 additions & 32 deletions packages/runtime/src/components/appbar.r.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/runtime/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from "./appbar.r";
export * from "./appLayout.r";
export * from "./button.r";
export * from "./div.r";
export * from "./forEach.r";
Expand All @@ -11,7 +11,7 @@ export * from "./table.r";
export * from "./tableItem.r";
export * from "./textNode.r";

import qAppbar from "./appbar.r";
import qAppLayout from "./appLayout.r";
import qButton from "./button.r";
import qDiv from "./div.r";
import qForEach from "./forEach.r";
Expand All @@ -25,7 +25,7 @@ import qTableItem from "./tableItem.r";
import qTextNode from "./textNode.r";

export const componentInfoObj = {
qAppbar,
qAppLayout,
qButton,
qDiv,
qForEach,
Expand Down

0 comments on commit 3e0fac3

Please sign in to comment.