Allow to set subapps properties.

This commit is contained in:
Madeorsk 2024-07-14 17:06:41 +02:00
parent 343bbfe785
commit 4a83e6a0fb
Signed by: Madeorsk
SSH key fingerprint: SHA256:J9G0ofIOLKf7kyS2IfrMqtMaPdfsk1W02+oGueZzDDU

View file

@ -1,6 +1,7 @@
import React from "react";
import {X} from "@phosphor-icons/react";
import {useCurtain, useCallableCurtain, useCurtains} from "../Curtains/Curtains";
import {classes, Modify} from "../../Utils";
/**
* More natural name of useCurtains for subapps.
@ -23,7 +24,7 @@ export const useCallableSubapp = useCallableCurtain;
/**
* Subapp main component.
*/
export function Subapp({title, closable, children}: React.PropsWithChildren<{
export function Subapp({className, title, closable, children}: React.PropsWithChildren<Modify<React.HTMLAttributes<HTMLDivElement>, {
/**
* Subapp title.
*/
@ -33,7 +34,7 @@ export function Subapp({title, closable, children}: React.PropsWithChildren<{
* Can disable close button.
*/
closable?: boolean;
}>)
}>>)
{
// Subapp is closable by default.
closable = closable !== undefined ? closable : true;
@ -42,7 +43,7 @@ export function Subapp({title, closable, children}: React.PropsWithChildren<{
const {close} = useSubapp();
return (
<div className={"subapp"}>
<div className={classes("subapp", className)}>
<header>
<h1>{title ?? ""}</h1>