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 {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>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue