mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 07:36:01 +00:00
editor theme
This commit is contained in:
@@ -9,6 +9,7 @@ import useShowModal from '../modals/showModal';
|
|||||||
import FilterMultipleValuesModal from '../modals/FilterMultipleValuesModal';
|
import FilterMultipleValuesModal from '../modals/FilterMultipleValuesModal';
|
||||||
import SetFilterModal from '../modals/SetFilterModal';
|
import SetFilterModal from '../modals/SetFilterModal';
|
||||||
import { FontIcon } from '../icons';
|
import { FontIcon } from '../icons';
|
||||||
|
import useTheme from '../theme/useTheme';
|
||||||
// import { $ } from '../../Utility/jquery';
|
// import { $ } from '../../Utility/jquery';
|
||||||
// import autobind from 'autobind-decorator';
|
// import autobind from 'autobind-decorator';
|
||||||
// import * as React from 'react';
|
// import * as React from 'react';
|
||||||
@@ -40,7 +41,12 @@ const FilterDiv = styled.div`
|
|||||||
const FilterInput = styled.input`
|
const FilterInput = styled.input`
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 10px;
|
min-width: 10px;
|
||||||
background-color: ${(props) => (props.state == 'ok' ? '#CCFFCC' : props.state == 'error' ? '#FFCCCC' : 'white')};
|
background-color: ${(props) =>
|
||||||
|
props.state == 'ok'
|
||||||
|
? props.theme.input_background_green[1]
|
||||||
|
: props.state == 'error'
|
||||||
|
? props.theme.input_background_red[1]
|
||||||
|
: props.theme.input_background};
|
||||||
`;
|
`;
|
||||||
// const FilterButton = styled.button`
|
// const FilterButton = styled.button`
|
||||||
// color: gray;
|
// color: gray;
|
||||||
@@ -176,6 +182,7 @@ export default function DataFilterControl({
|
|||||||
onFocusGrid,
|
onFocusGrid,
|
||||||
}) {
|
}) {
|
||||||
const showModal = useShowModal();
|
const showModal = useShowModal();
|
||||||
|
const theme = useTheme();
|
||||||
const [filterState, setFilterState] = React.useState('empty');
|
const [filterState, setFilterState] = React.useState('empty');
|
||||||
const setFilterText = (filter) => {
|
const setFilterText = (filter) => {
|
||||||
setFilter(filter);
|
setFilter(filter);
|
||||||
@@ -281,6 +288,7 @@ export default function DataFilterControl({
|
|||||||
return (
|
return (
|
||||||
<FilterDiv>
|
<FilterDiv>
|
||||||
<FilterInput
|
<FilterInput
|
||||||
|
theme={theme}
|
||||||
ref={editorRef}
|
ref={editorRef}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import 'ace-builds/src-noconflict/mode-pgsql';
|
|||||||
import 'ace-builds/src-noconflict/mode-sqlserver';
|
import 'ace-builds/src-noconflict/mode-sqlserver';
|
||||||
import 'ace-builds/src-noconflict/mode-javascript';
|
import 'ace-builds/src-noconflict/mode-javascript';
|
||||||
import 'ace-builds/src-noconflict/theme-github';
|
import 'ace-builds/src-noconflict/theme-github';
|
||||||
|
import 'ace-builds/src-noconflict/theme-twilight';
|
||||||
import 'ace-builds/src-noconflict/ext-searchbox';
|
import 'ace-builds/src-noconflict/ext-searchbox';
|
||||||
import 'ace-builds/src-noconflict/ext-language_tools';
|
import 'ace-builds/src-noconflict/ext-language_tools';
|
||||||
import localStorageGarbageCollector from './utility/localStorageGarbageCollector';
|
import localStorageGarbageCollector from './utility/localStorageGarbageCollector';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Modal from 'react-modal';
|
import Modal from 'react-modal';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
import useTheme from '../theme/useTheme';
|
||||||
|
|
||||||
// const StyledModal = styled(Modal)`
|
// const StyledModal = styled(Modal)`
|
||||||
// position: absolute;
|
// position: absolute;
|
||||||
@@ -60,6 +61,7 @@ const ModalContent = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export default function ModalBase({ modalState, children, isFlex = false, fullScreen = false }) {
|
export default function ModalBase({ modalState, children, isFlex = false, fullScreen = false }) {
|
||||||
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<StyledModal
|
<StyledModal
|
||||||
isOpen={modalState.isOpen}
|
isOpen={modalState.isOpen}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import AceEditor from 'react-ace';
|
import AceEditor from 'react-ace';
|
||||||
import useDimensions from '../utility/useDimensions';
|
import useDimensions from '../utility/useDimensions';
|
||||||
|
import useTheme from '../theme/useTheme';
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -22,6 +23,7 @@ export default function JavaScriptEditor({
|
|||||||
}) {
|
}) {
|
||||||
const [containerRef, { height, width }] = useDimensions();
|
const [containerRef, { height, width }] = useDimensions();
|
||||||
const ownEditorRef = React.useRef(null);
|
const ownEditorRef = React.useRef(null);
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
const currentEditorRef = editorRef || ownEditorRef;
|
const currentEditorRef = editorRef || ownEditorRef;
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ export default function JavaScriptEditor({
|
|||||||
<AceEditor
|
<AceEditor
|
||||||
ref={currentEditorRef}
|
ref={currentEditorRef}
|
||||||
mode="javascript"
|
mode="javascript"
|
||||||
theme="github"
|
theme={theme.aceEditorTheme}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
name="UNIQUE_ID_OF_DIV"
|
name="UNIQUE_ID_OF_DIV"
|
||||||
editorProps={{ $blockScrolling: true }}
|
editorProps={{ $blockScrolling: true }}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import useCodeCompletion from './useCodeCompletion';
|
|||||||
import useShowModal from '../modals/showModal';
|
import useShowModal from '../modals/showModal';
|
||||||
import InsertJoinModal from '../modals/InsertJoinModal';
|
import InsertJoinModal from '../modals/InsertJoinModal';
|
||||||
import { getDatabaseInfo } from '../utility/metadataLoaders';
|
import { getDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
|
import useTheme from '../theme/useTheme';
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -55,6 +56,7 @@ export default function SqlEditor({
|
|||||||
}) {
|
}) {
|
||||||
const [containerRef, { height, width }] = useDimensions();
|
const [containerRef, { height, width }] = useDimensions();
|
||||||
const ownEditorRef = React.useRef(null);
|
const ownEditorRef = React.useRef(null);
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
const currentEditorRef = editorRef || ownEditorRef;
|
const currentEditorRef = editorRef || ownEditorRef;
|
||||||
const showModal = useShowModal();
|
const showModal = useShowModal();
|
||||||
@@ -109,7 +111,7 @@ export default function SqlEditor({
|
|||||||
<AceEditor
|
<AceEditor
|
||||||
ref={currentEditorRef}
|
ref={currentEditorRef}
|
||||||
mode={engineToMode[engine] || 'sql'}
|
mode={engineToMode[engine] || 'sql'}
|
||||||
theme="github"
|
theme={theme.aceEditorTheme}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
name="UNIQUE_ID_OF_DIV"
|
name="UNIQUE_ID_OF_DIV"
|
||||||
editorProps={{ $blockScrolling: true }}
|
editorProps={{ $blockScrolling: true }}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ const theme = {
|
|||||||
main_type: 'dark',
|
main_type: 'dark',
|
||||||
main_background: '#fff',
|
main_background: '#fff',
|
||||||
|
|
||||||
|
fontWhite1: '#ddd',
|
||||||
|
|
||||||
selectionAntName: 'blue',
|
selectionAntName: 'blue',
|
||||||
|
aceEditorTheme: 'twilight',
|
||||||
|
|
||||||
border: '#555',
|
border: '#555',
|
||||||
|
|
||||||
@@ -18,6 +21,7 @@ const theme = {
|
|||||||
gridheader_background: '#222',
|
gridheader_background: '#222',
|
||||||
gridbody_background: '#000',
|
gridbody_background: '#000',
|
||||||
scrollbar_background: '#444',
|
scrollbar_background: '#444',
|
||||||
|
input_background: '#333',
|
||||||
|
|
||||||
statusBarBackground: '#00c',
|
statusBarBackground: '#00c',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const theme = {
|
|||||||
main_background: '#fff',
|
main_background: '#fff',
|
||||||
|
|
||||||
selectionAntName: 'blue',
|
selectionAntName: 'blue',
|
||||||
|
aceEditorTheme: 'github',
|
||||||
|
|
||||||
border: '#ccc',
|
border: '#ccc',
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ const theme = {
|
|||||||
gridheader_type: 'light',
|
gridheader_type: 'light',
|
||||||
gridbody_background: '#fff',
|
gridbody_background: '#fff',
|
||||||
scrollbar_background: '#ddd',
|
scrollbar_background: '#ddd',
|
||||||
|
input_background: '#fff',
|
||||||
|
|
||||||
statusBarBackground: '#00c',
|
statusBarBackground: '#00c',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,6 +42,22 @@ export default function ThemeHelmet() {
|
|||||||
body *::-webkit-scrollbar-thumb:hover {
|
body *::-webkit-scrollbar-thumb:hover {
|
||||||
background-color: ${theme.scrollbar_background4};
|
background-color: ${theme.scrollbar_background4};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background-color: ${theme.input_background};
|
||||||
|
color: ${theme.input_font1};
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
background-color: ${theme.input_background};
|
||||||
|
color: ${theme.input_font1};
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
background-color: ${theme.input_background};
|
||||||
|
color: ${theme.input_font1};
|
||||||
|
}
|
||||||
|
|
||||||
`}</style>
|
`}</style>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user