From 93ac15f1c2c91bd106cdb1512cb5da2bd2d34c6a Mon Sep 17 00:00:00 2001 From: Harshit Vishnoi <5825564-HARDY8118@users.noreply.gitlab.com> Date: Wed, 10 Aug 2022 22:10:56 +0530 Subject: [PATCH] Fixed title bar position Added style prop for content --- README.md | 1 + src/Window.css | 7 +++---- src/Window.tsx | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 76eca0d..f8b81f2 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ A floating window which can be dragged, minimized, maximized and moved across. |**left**|number|0|✗|Left position of window with repect to parent element in px| |**resizable**|boolean|false|✗|Make window resizable of not| |**titleBar**|object| |✗|Refer [Title Bar props](./README.md#title-bar-properties)| +|**style**|object|{}|&cross|CSS styles applied to content window| ### Title Bar properties diff --git a/src/Window.css b/src/Window.css index 7257c2f..734683a 100644 --- a/src/Window.css +++ b/src/Window.css @@ -2,7 +2,7 @@ div.window-container { position: absolute; border: solid 1px black; --tilebar-height: 32px; - overflow: auto; + overflow: hidden; display: flex; flex-direction: column; } @@ -13,9 +13,7 @@ div.window-container > div.title-bar { display: flex; flex-direction: row; cursor: default; - position: fixed; - top: 0; - left: 0; + position: static; } div.window-container > div.title-bar > span.icon { @@ -68,4 +66,5 @@ div.window-container div.window-container > div.content { all: initial; background-color: white; + overflow: scroll; } diff --git a/src/Window.tsx b/src/Window.tsx index f18497f..7ffc191 100644 --- a/src/Window.tsx +++ b/src/Window.tsx @@ -18,6 +18,7 @@ interface WindowProps { close?: () => void; }; }; + style?: React.CSSProperties; } const nextZIndex: () => number = () => { @@ -57,6 +58,7 @@ const Window: React.FC = (props: WindowProps) => { }, props.titleBar ), + style: {}, }, props ); @@ -253,6 +255,7 @@ const Window: React.FC = (props: WindowProps) => { style={{ height: contentDisplay ? "auto" : 0, opacity: visibility, + ...properties.style, }} > {properties.children}