dark mode fixes

This commit is contained in:
Jan Prochazka
2020-11-13 18:43:06 +01:00
parent 08efc787c7
commit 7f7d39cfc2
7 changed files with 20 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import ReactJson from 'react-json-view'; import ReactJson from 'react-json-view';
import ErrorInfo from '../widgets/ErrorInfo'; import ErrorInfo from '../widgets/ErrorInfo';
import useTheme from '../theme/useTheme';
const OuterWrapper = styled.div` const OuterWrapper = styled.div`
flex: 1; flex: 1;
@@ -18,12 +19,13 @@ const InnerWrapper = styled.div`
`; `;
export default function JsonCellView({ value }) { export default function JsonCellView({ value }) {
const theme = useTheme();
try { try {
const json = JSON.parse(value); const json = JSON.parse(value);
return ( return (
<OuterWrapper> <OuterWrapper>
<InnerWrapper> <InnerWrapper>
<ReactJson src={json} /> <ReactJson src={json} theme={theme.jsonViewerTheme} />
</InnerWrapper> </InnerWrapper>
</OuterWrapper> </OuterWrapper>
); );

View File

@@ -6,6 +6,7 @@ import { TableColumn } from '../utility/TableControl';
import columnAppObject from '../appobj/columnAppObject'; import columnAppObject from '../appobj/columnAppObject';
import constraintAppObject from '../appobj/constraintAppObject'; import constraintAppObject from '../appobj/constraintAppObject';
import { useTableInfo, useDbCore } from '../utility/metadataLoaders'; import { useTableInfo, useDbCore } from '../utility/metadataLoaders';
import useTheme from '../theme/useTheme';
const WhitePage = styled.div` const WhitePage = styled.div`
position: absolute; position: absolute;
@@ -13,15 +14,17 @@ const WhitePage = styled.div`
top: 0; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: white; background-color: ${(props) => props.theme.main_background};
overflow: auto;
`; `;
export default function TableStructureTab({ conid, database, schemaName, pureName, objectTypeField = 'tables' }) { export default function TableStructureTab({ conid, database, schemaName, pureName, objectTypeField = 'tables' }) {
const theme = useTheme();
const tableInfo = useDbCore({ conid, database, schemaName, pureName, objectTypeField }); const tableInfo = useDbCore({ conid, database, schemaName, pureName, objectTypeField });
if (!tableInfo) return null; if (!tableInfo) return null;
const { columns, primaryKey, foreignKeys, dependencies } = tableInfo; const { columns, primaryKey, foreignKeys, dependencies } = tableInfo;
return ( return (
<WhitePage> <WhitePage theme={theme}>
<ObjectListControl <ObjectListControl
collection={columns.map((x, index) => ({ ...x, ordinal: index + 1 }))} collection={columns.map((x, index) => ({ ...x, ordinal: index + 1 }))}
makeAppObj={columnAppObject} makeAppObj={columnAppObject}

View File

@@ -8,6 +8,7 @@ const theme = {
selectionAntName: 'blue', selectionAntName: 'blue',
aceEditorTheme: 'twilight', aceEditorTheme: 'twilight',
jsonViewerTheme: 'monokai',
border: '#555', border: '#555',
border_background: '#555', border_background: '#555',
@@ -19,7 +20,7 @@ const theme = {
title_background: '#555', title_background: '#555',
manager_background: '#222', manager_background: '#222',
tabs_background: '#111', tabs_background: '#111',
gridheader_background: '#222', gridheader_background: '#333',
gridbody_background: '#1a1a1a', gridbody_background: '#1a1a1a',
scrollbar_background: '#444', scrollbar_background: '#444',
input_background: '#222', input_background: '#222',

View File

@@ -6,6 +6,7 @@ const theme = {
selectionAntName: 'blue', selectionAntName: 'blue',
aceEditorTheme: 'github', aceEditorTheme: 'github',
jsonViewerTheme: 'rjv-default',
border: '#ccc', border: '#ccc',
border_background: '#ccc', border_background: '#ccc',

View File

@@ -37,16 +37,19 @@ export default function ThemeHelmet() {
input { input {
background-color: ${theme.input_background}; background-color: ${theme.input_background};
color: ${theme.input_font1}; color: ${theme.input_font1};
border: 1px solid ${theme.border};
} }
select { select {
background-color: ${theme.input_background}; background-color: ${theme.input_background};
color: ${theme.input_font1}; color: ${theme.input_font1};
border: 1px solid ${theme.border};
} }
textarea { textarea {
background-color: ${theme.input_background}; background-color: ${theme.input_background};
color: ${theme.input_font1}; color: ${theme.input_font1};
border: 1px solid ${theme.border};
} }
${_.flatten( ${_.flatten(

View File

@@ -2,13 +2,14 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import TableControl, { TableColumn } from './TableControl'; import TableControl, { TableColumn } from './TableControl';
import { AppObjectControl } from '../appobj/AppObjects'; import { AppObjectControl } from '../appobj/AppObjects';
import useTheme from '../theme/useTheme';
const ObjectListWrapper = styled.div` const ObjectListWrapper = styled.div`
margin-bottom: 20px; margin-bottom: 20px;
`; `;
const ObjectListHeader = styled.div` const ObjectListHeader = styled.div`
background-color: #ebedef; background-color: ${(props) => props.theme.gridheader_background};
padding: 5px; padding: 5px;
`; `;
@@ -25,11 +26,12 @@ const ObjectListBody = styled.div`
`; `;
export default function ObjectListControl({ collection = [], title, showIfEmpty = false, makeAppObj, children }) { export default function ObjectListControl({ collection = [], title, showIfEmpty = false, makeAppObj, children }) {
const theme = useTheme();
if (collection.length == 0 && !showIfEmpty) return null; if (collection.length == 0 && !showIfEmpty) return null;
return ( return (
<ObjectListWrapper> <ObjectListWrapper>
<ObjectListHeader> <ObjectListHeader theme={theme}>
<ObjectListHeaderTitle>{title}</ObjectListHeaderTitle> <ObjectListHeaderTitle>{title}</ObjectListHeaderTitle>
</ObjectListHeader> </ObjectListHeader>
<ObjectListBody> <ObjectListBody>

View File

@@ -45,7 +45,8 @@ export function WidgetsOuterContainer({ children, style = undefined, refNode = u
export const StyledWidgetsInnerContainer = styled.div` export const StyledWidgetsInnerContainer = styled.div`
flex: 1 1; flex: 1 1;
overflow: scroll; overflow-x: auto;
overflow-y: auto;
width: ${(props) => props.leftPanelWidth}px; width: ${(props) => props.leftPanelWidth}px;
`; `;