From a53d76d28750b03744727f2646313bccb120dbcb Mon Sep 17 00:00:00 2001 From: Fawn Date: Fri, 26 Jul 2019 19:13:39 -0400 Subject: moved schema toolbar into collection chrome --- .../views/collections/CollectionViewChromes.tsx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionViewChromes.tsx b/src/client/views/collections/CollectionViewChromes.tsx index 1ad9e47ce..de1d01ef0 100644 --- a/src/client/views/collections/CollectionViewChromes.tsx +++ b/src/client/views/collections/CollectionViewChromes.tsx @@ -16,6 +16,7 @@ import KeyRestrictionRow from "./KeyRestrictionRow"; import { CompileScript } from "../../util/Scripting"; import { ScriptField } from "../../../new_fields/ScriptField"; import { CollectionSchemaView } from "./CollectionSchemaView"; +import { COLLECTION_BORDER_WIDTH } from "../globalCssVariables.scss"; const datepicker = require('js-datepicker'); interface CollectionViewChromeProps { @@ -346,16 +347,26 @@ export class CollectionStackingViewChrome extends React.Component { +export class CollectionSchemaViewChrome extends React.Component { + + togglePreview = () => { + let dividerWidth = 4; + let borderWidth = Number(COLLECTION_BORDER_WIDTH); + let panelWidth = this.props.CollectionView.props.PanelWidth(); + let previewWidth = NumCast(this.props.CollectionView.props.Document.schemaPreviewWidth); + let tableWidth = panelWidth - 2 * borderWidth - dividerWidth - previewWidth; + this.props.CollectionView.props.Document.schemaPreviewWidth = previewWidth === 0 ? Math.min(tableWidth / 3, 200) : 0; + + } + + render() { + let previewWidth = NumCast(this.props.CollectionView.props.Document.schemaPreviewWidth); return (
- {this.props.toolbar} +
Show Preview
); } -- cgit v1.2.3-70-g09d2