Skip to content

Commit

Permalink
style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nealus committed Oct 25, 2021
1 parent f53bba3 commit 377bf18
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 52 deletions.
8 changes: 6 additions & 2 deletions examples/demo/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ILayoutProps, ITabRenderValues, ITabSetRenderValues } from "../../src/v
import { TabStorage } from "./TabStorage";
import Utils from "./Utils";
import { showPopup } from "./PopupMenu";
import { NewFeatures } from "./NewFeatures";

var fields = ["Name", "Field1", "Field2", "Field3", "Field4", "Field5"];

Expand Down Expand Up @@ -164,7 +165,7 @@ class App extends React.Component<any, { layoutFile: string | null, model: FlexL
event.stopPropagation();
console.log(node, event);
showPopup(
node instanceof TabNode? "Tab: " + node.getName() : "Type: " + node.getType(),
node instanceof TabNode ? "Tab: " + node.getName() : "Type: " + node.getType(),
(this.refs.layout as FlexLayout.Layout).getRootDiv(),
event.clientX, event.clientY,
["Option 1", "Option 2"],
Expand Down Expand Up @@ -297,7 +298,10 @@ class App extends React.Component<any, { layoutFile: string | null, model: FlexL
} catch (e) {
console.log(e);
}
}
}
else if (component === "newfeatures") {
return <NewFeatures />;
}
else if (component === "multitype") {
try {
const config = node.getConfig();
Expand Down
49 changes: 15 additions & 34 deletions examples/demo/newfeatures.html → examples/demo/NewFeatures.tsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,44 @@
<!DOCTYPE html>
<html>
import * as React from "react";

<head>
<meta http-equiv='Content-type' content='text/html; charset=utf-8'>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
<link id="page-stylesheet" rel="stylesheet" href="gray.css" />
<style>
body {
overflow: auto;
}
ul {
margin-right: 1em;
}
li {
margin-bottom: 1em;
}
</style>
</head>

<body>

<ul>
export function NewFeatures() {
return (
<ul>
<li>
Help text (tooltip) option on tabs: <br>
Help text (tooltip) option on tabs: <br/>
<small>Hover over this tab button</small>
</li>
<li>
Action to close tabset:<br>
Action to close tabset:<br/>
<small>See added x button in this tabset</small>
</li>
<li>
Intercept drag drop to allow dropping tabs into custom areas:<br>
Intercept drag drop to allow dropping tabs into custom areas:<br/>
<small>See Tab Storage tab</small>
</li>
<li>
Allow narrow splitters with extended hit test areas:<br>
Allow narrow splitters with extended hit test areas:<br/>
<small>Uses the splitterExtra global attribute</small>
</li>
<li>
Tab attributes: borderWidth, borderHeight to allow tabs to have individual sizes in borders:<br>
Tab attributes: borderWidth, borderHeight to allow tabs to have individual sizes in borders:<br/>
<small>Try the 'With border sizes' tab</small>
</li>
<li>
Customize the drag rectangle using the callback property: onRenderDragRect <br>
Customize the drag rectangle using the callback property: onRenderDragRect <br/>
<small>In this layout all drag rectangles are custom rendered</small>
</li>
<li>
New border attribute: enableAutoHide, to hide border if it has zero tabs:<br>
New border attribute: enableAutoHide, to hide border if it has zero tabs:<br/>
<small>Try moving all tabs from any of the borders</small>
</li>
<li>
New onRenderFloatingTabPlaceholder prop:<br>
New onRenderFloatingTabPlaceholder prop:<br/>
<small>Popout one of the tabs to see the custom rendered placeholder</small>
</li>
<li>
New onContextMenu prop:<br>
New onContextMenu prop:<br/>
<small>All tabs and tabsets in this layout have a custom context menu</small>
</li>
</ul>
</body>

</html>
);
}
14 changes: 14 additions & 0 deletions examples/demo/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,17 @@ html,body
.tab-storage > .tab-storage-tabs > .tab-storage-entry:last-child {
margin-bottom: 0;
}

small {
color: lightgray;
}

li {
color:white
;
margin-bottom: 1em;
}

ul {
margin-right: 1em;
}
5 changes: 5 additions & 0 deletions examples/demo/gray.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,9 @@ small {

li {
color: #444;
margin-bottom: 1em;
}

ul {
margin-right: 1em;
}
6 changes: 1 addition & 5 deletions examples/demo/layouts/newfeatures.layout
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
"type": "tab",
"name": "New",
"helpText": "this tab has helpText defined",
"component": "multitype",
"config": {
"type":"url",
"data":"newfeatures.html"
}
"component": "newfeatures"
},
{
"type": "tab",
Expand Down
13 changes: 13 additions & 0 deletions examples/demo/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,16 @@ select, button {
margin-bottom: 0;
}


small {
color: gray;
}

li {
color: #444;
margin-bottom: 1em;
}

ul {
margin-right: 1em;
}
3 changes: 3 additions & 0 deletions examples/demo/popupmenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
font-family: var(--font-family);
}
.popup_menu_title {
margin: 2px;
padding: 2px 10px 2px 10px;
white-space: nowrap;
color: var(--color-text);
Expand All @@ -11,9 +12,11 @@
cursor: default;
}
.popup_menu_item {
margin: 2px;
padding: 2px 10px 2px 10px;
white-space: nowrap;
cursor:pointer;
border-radius: 2px;
}
@media (hover: hover) {
.popup_menu_item:hover {
Expand Down
10 changes: 7 additions & 3 deletions src/model/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,17 @@ class Model {
const node = this._idMap[action.data.node];

if (node instanceof TabSetNode) {
// first delete all child tabs
// first delete all child tabs that are closeable
const children = [...node.getChildren()];
children.forEach((child, i) => {
(child as TabNode)._delete();
if ((child as TabNode).isEnableClose()) {
(child as TabNode)._delete();
}
});

node._delete();
if (node.getChildren().length === 0) {
node._delete();
}
this._tidy();
}
break;
Expand Down
10 changes: 8 additions & 2 deletions style/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,12 @@

&_textbox {
border: none;
color: green;
background-color: var(--color-3);
font-family: var(--font-family);
font-size: var(--font-size);
color: var(--color-text);
background-color: var(--color-5);
border: 1px inset var(--color-1);
border-radius: 3px;
}

&_textbox:focus {
Expand Down Expand Up @@ -494,9 +498,11 @@
font-family: var(--font-family);

&_item {
margin: 2px;
padding: 2px 10px 2px 10px;
white-space: nowrap;
cursor: pointer;
border-radius: 2px;
}

@media (hover: hover) {
Expand Down
10 changes: 8 additions & 2 deletions style/dark.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions style/gray.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions style/light.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 377bf18

Please sign in to comment.