Allow to set subapps properties.
This commit is contained in:
parent
343bbfe785
commit
4a83e6a0fb
1 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {X} from "@phosphor-icons/react";
|
import {X} from "@phosphor-icons/react";
|
||||||
import {useCurtain, useCallableCurtain, useCurtains} from "../Curtains/Curtains";
|
import {useCurtain, useCallableCurtain, useCurtains} from "../Curtains/Curtains";
|
||||||
|
import {classes, Modify} from "../../Utils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* More natural name of useCurtains for subapps.
|
* More natural name of useCurtains for subapps.
|
||||||
|
@ -23,7 +24,7 @@ export const useCallableSubapp = useCallableCurtain;
|
||||||
/**
|
/**
|
||||||
* Subapp main component.
|
* 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.
|
* Subapp title.
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +34,7 @@ export function Subapp({title, closable, children}: React.PropsWithChildren<{
|
||||||
* Can disable close button.
|
* Can disable close button.
|
||||||
*/
|
*/
|
||||||
closable?: boolean;
|
closable?: boolean;
|
||||||
}>)
|
}>>)
|
||||||
{
|
{
|
||||||
// Subapp is closable by default.
|
// Subapp is closable by default.
|
||||||
closable = closable !== undefined ? closable : true;
|
closable = closable !== undefined ? closable : true;
|
||||||
|
@ -42,7 +43,7 @@ export function Subapp({title, closable, children}: React.PropsWithChildren<{
|
||||||
const {close} = useSubapp();
|
const {close} = useSubapp();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={"subapp"}>
|
<div className={classes("subapp", className)}>
|
||||||
<header>
|
<header>
|
||||||
<h1>{title ?? ""}</h1>
|
<h1>{title ?? ""}</h1>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue