theme - modals, react select, tables

This commit is contained in:
Jan Prochazka
2020-11-12 14:20:02 +01:00
parent a49f429f13
commit a8d88d05db
17 changed files with 148 additions and 83 deletions

View File

@@ -118,6 +118,7 @@ export default function Screen() {
{!!currentWidget && ( {!!currentWidget && (
<ScreenHorizontalSplitHandle <ScreenHorizontalSplitHandle
onMouseDown={onSplitDown} onMouseDown={onSplitDown}
theme={theme}
style={{ left: leftPanelWidth + dimensions.widgetMenu.iconSize }} style={{ left: leftPanelWidth + dimensions.widgetMenu.iconSize }}
/> />
)} )}

View File

@@ -3,6 +3,7 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { ManagerInnerContainer } from '../datagrid/ManagerStyles'; import { ManagerInnerContainer } from '../datagrid/ManagerStyles';
import { FontIcon } from '../icons'; import { FontIcon } from '../icons';
import useTheme from '../theme/useTheme';
import keycodes from '../utility/keycodes'; import keycodes from '../utility/keycodes';
const Row = styled.div` const Row = styled.div`
@@ -13,7 +14,7 @@ const Row = styled.div`
// padding: 5px; // padding: 5px;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
background-color: lightblue; background-color: ${(props) => props.theme.manager_background_blue[1]};
} }
`; `;
const Name = styled.div` const Name = styled.div`
@@ -28,7 +29,7 @@ const Icon = styled(FontIcon)`
position: relative; position: relative;
top: 5px; top: 5px;
&:hover { &:hover {
background-color: gray; background-color: ${(props) => props.theme.manager_background3};
} }
padding: 5px; padding: 5px;
`; `;
@@ -36,7 +37,7 @@ const EditorInput = styled.input`
width: calc(100% - 10px); width: calc(100% - 10px);
background-color: ${(props) => background-color: ${(props) =>
// @ts-ignore // @ts-ignore
props.isError ? '#FFCCCC' : 'white'}; props.isError ? props.theme.manager_background_red[1] : props.theme.manager_background};
`; `;
function ColumnNameEditor({ function ColumnNameEditor({
@@ -48,6 +49,7 @@ function ColumnNameEditor({
defaultValue = '', defaultValue = '',
...other ...other
}) { }) {
const theme = useTheme();
const [value, setValue] = React.useState(defaultValue || ''); const [value, setValue] = React.useState(defaultValue || '');
const editorRef = React.useRef(null); const editorRef = React.useRef(null);
const isError = value && existingNames && existingNames.includes(value); const isError = value && existingNames && existingNames.includes(value);
@@ -74,6 +76,7 @@ function ColumnNameEditor({
}, [focusOnCreate]); }, [focusOnCreate]);
return ( return (
<EditorInput <EditorInput
theme={theme}
ref={editorRef} ref={editorRef}
type="text" type="text"
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
@@ -97,14 +100,15 @@ function exchange(array, i1, i2) {
function ColumnManagerRow({ column, onEdit, onRemove, onUp, onDown }) { function ColumnManagerRow({ column, onEdit, onRemove, onUp, onDown }) {
const [isHover, setIsHover] = React.useState(false); const [isHover, setIsHover] = React.useState(false);
const theme = useTheme();
return ( return (
<Row onMouseEnter={() => setIsHover(true)} onMouseLeave={() => setIsHover(false)}> <Row onMouseEnter={() => setIsHover(true)} onMouseLeave={() => setIsHover(false)} theme={theme}>
<Name>{column.columnName}</Name> <Name>{column.columnName}</Name>
<Buttons> <Buttons>
<Icon icon="icon edit" onClick={onEdit} /> <Icon icon="icon edit" onClick={onEdit} theme={theme} />
<Icon icon="icon delete" onClick={onRemove} /> <Icon icon="icon delete" onClick={onRemove} theme={theme} />
<Icon icon="icon arrow-up" onClick={onUp} /> <Icon icon="icon arrow-up" onClick={onUp} theme={theme} />
<Icon icon="icon arrow-down" onClick={onDown} /> <Icon icon="icon arrow-down" onClick={onDown} theme={theme} />
</Buttons> </Buttons>
</Row> </Row>
); );

View File

@@ -9,9 +9,10 @@ import FreeTableGridCore from './FreeTableGridCore';
import MacroDetail from './MacroDetail'; import MacroDetail from './MacroDetail';
import MacroManager from './MacroManager'; import MacroManager from './MacroManager';
import WidgetColumnBar, { WidgetColumnBarItem } from '../widgets/WidgetColumnBar'; import WidgetColumnBar, { WidgetColumnBarItem } from '../widgets/WidgetColumnBar';
import useTheme from '../theme/useTheme';
const LeftContainer = styled.div` const LeftContainer = styled.div`
background-color: white; background-color: ${(props) => props.theme.manager_background};
display: flex; display: flex;
flex: 1; flex: 1;
`; `;
@@ -31,6 +32,7 @@ function extractMacroValuesForMacro(macroValues, macro) {
export default function FreeTableGrid(props) { export default function FreeTableGrid(props) {
const { modelState, dispatchModel } = props; const { modelState, dispatchModel } = props;
const theme = useTheme();
const [managerSize, setManagerSize] = React.useState(0); const [managerSize, setManagerSize] = React.useState(0);
const [selectedMacro, setSelectedMacro] = React.useState(null); const [selectedMacro, setSelectedMacro] = React.useState(null);
const [macroValues, setMacroValues] = React.useState({}); const [macroValues, setMacroValues] = React.useState({});
@@ -49,7 +51,7 @@ export default function FreeTableGrid(props) {
// console.log('macroValues', macroValues); // console.log('macroValues', macroValues);
return ( return (
<HorizontalSplitter initialValue="300px" size={managerSize} setSize={setManagerSize}> <HorizontalSplitter initialValue="300px" size={managerSize} setSize={setManagerSize}>
<LeftContainer> <LeftContainer theme={theme}>
<WidgetColumnBar> <WidgetColumnBar>
<WidgetColumnBarItem title="Columns" name="columns" height="40%"> <WidgetColumnBarItem title="Columns" name="columns" height="40%">
<FreeTableColumnEditor {...props} /> <FreeTableColumnEditor {...props} />

View File

@@ -24,6 +24,7 @@ import LoadingInfo from '../widgets/LoadingInfo';
import SqlEditor from '../sqleditor/SqlEditor'; import SqlEditor from '../sqleditor/SqlEditor';
import { useUploadsProvider } from '../utility/UploadsProvider'; import { useUploadsProvider } from '../utility/UploadsProvider';
import { FontIcon } from '../icons'; import { FontIcon } from '../icons';
import useTheme from '../theme/useTheme';
const Container = styled.div` const Container = styled.div`
// max-height: 50vh; // max-height: 50vh;
@@ -67,12 +68,12 @@ const SqlWrapper = styled.div`
const DragWrapper = styled.div` const DragWrapper = styled.div`
padding: 10px; padding: 10px;
background: #ddd; background: ${(props) => props.theme.modal_background2};
`; `;
const ArrowWrapper = styled.div` const ArrowWrapper = styled.div`
font-size: 30px; font-size: 30px;
color: blue; color: ${(props) => props.theme.modal_font_blue[7]};
align-self: center; align-self: center;
`; `;
@@ -151,11 +152,12 @@ function ElectronFilesInput() {
} }
function FilesInput() { function FilesInput() {
const theme = useTheme();
const electron = getElectron(); const electron = getElectron();
if (electron) { if (electron) {
return <ElectronFilesInput />; return <ElectronFilesInput />;
} }
return <DragWrapper>Drag &amp; drop imported files here</DragWrapper>; return <DragWrapper theme={theme}>Drag &amp; drop imported files here</DragWrapper>;
} }
function SourceTargetConfig({ function SourceTargetConfig({
@@ -308,6 +310,7 @@ export default function ImportExportConfigurator({ uploadedFile = undefined }) {
const { engine: sourceEngine } = sourceConnectionInfo || {}; const { engine: sourceEngine } = sourceConnectionInfo || {};
const { sourceList } = values; const { sourceList } = values;
const { uploadListener, setUploadListener } = useUploadsProvider(); const { uploadListener, setUploadListener } = useUploadsProvider();
const theme = useTheme();
const handleUpload = React.useCallback( const handleUpload = React.useCallback(
(file) => { (file) => {
@@ -352,7 +355,7 @@ export default function ImportExportConfigurator({ uploadedFile = undefined }) {
tablesField="sourceList" tablesField="sourceList"
engine={sourceEngine} engine={sourceEngine}
/> />
<ArrowWrapper> <ArrowWrapper theme={theme}>
<FontIcon icon="icon arrow-right" /> <FontIcon icon="icon arrow-right" />
</ArrowWrapper> </ArrowWrapper>
<SourceTargetConfig <SourceTargetConfig

View File

@@ -15,6 +15,7 @@ import axios from '../utility/axios';
import WidgetColumnBar, { WidgetColumnBarItem } from '../widgets/WidgetColumnBar'; import WidgetColumnBar, { WidgetColumnBarItem } from '../widgets/WidgetColumnBar';
import SocketMessagesView from '../query/SocketMessagesView'; import SocketMessagesView from '../query/SocketMessagesView';
import RunnerOutputFiles from '../query/RunnerOuputFiles'; import RunnerOutputFiles from '../query/RunnerOuputFiles';
import useTheme from '../theme/useTheme';
const headerHeight = '60px'; const headerHeight = '60px';
const footerHeight = '60px'; const footerHeight = '60px';
@@ -72,9 +73,9 @@ const Footer = styled.div`
left: 0; left: 0;
right: 0; right: 0;
bottom: 0px; bottom: 0px;
background-color: #eeffff; background-color: ${(props) => props.theme.modalheader_background};
border-top: 1px solid #ccc; border-top: 1px solid ${(props) => props.theme.border};
// padding: 15px; // padding: 15px;
`; `;
@@ -106,6 +107,7 @@ export default function ImportExportModal({ modalState, initialValues, uploadedF
const [executeNumber, setExecuteNumber] = React.useState(0); const [executeNumber, setExecuteNumber] = React.useState(0);
const [runnerId, setRunnerId] = React.useState(null); const [runnerId, setRunnerId] = React.useState(null);
const archive = useCurrentArchive(); const archive = useCurrentArchive();
const theme = useTheme();
const handleExecute = async (values) => { const handleExecute = async (values) => {
const script = await createImpExpScript(values); const script = await createImpExpScript(values);
@@ -153,7 +155,7 @@ export default function ImportExportModal({ modalState, initialValues, uploadedF
</WidgetColumnBar> </WidgetColumnBar>
</WidgetColumnWrapper> </WidgetColumnWrapper>
</Wrapper> </Wrapper>
<Footer> <Footer theme={theme}>
<FooterButtons> <FooterButtons>
<FormStyledButton type="submit" value="Run" /> <FormStyledButton type="submit" value="Run" />
<GenerateSctriptButton modalState={modalState} /> <GenerateSctriptButton modalState={modalState} />

View File

@@ -19,8 +19,8 @@ import useTheme from '../theme/useTheme';
// `; // `;
const StyledModal = styled(Modal)` const StyledModal = styled(Modal)`
border: 1px solid #ccc; border: 1px solid ${(props) => props.theme.border};
background: #fff; background: ${(props) => props.theme.modal_background};
overflow: auto; overflow: auto;
webkitoverflowscrolling: touch; webkitoverflowscrolling: touch;
outline: none; outline: none;
@@ -64,6 +64,7 @@ export default function ModalBase({ modalState, children, isFlex = false, fullSc
const theme = useTheme(); const theme = useTheme();
return ( return (
<StyledModal <StyledModal
theme={theme}
isOpen={modalState.isOpen} isOpen={modalState.isOpen}
onRequestClose={modalState.close} onRequestClose={modalState.close}
overlayClassName="RactModalOverlay" overlayClassName="RactModalOverlay"

View File

@@ -1,12 +1,14 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import useTheme from '../theme/useTheme';
const Wrapper = styled.div` const Wrapper = styled.div`
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
padding: 15px; padding: 15px;
background-color: #eeffff; background-color: ${(props) => props.theme.modalheader_background};
`; `;
export default function ModalFooter({ children }) { export default function ModalFooter({ children }) {
return <Wrapper>{children}</Wrapper>; const theme = useTheme();
return <Wrapper theme={theme}>{children}</Wrapper>;
} }

View File

@@ -1,29 +1,31 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { FontIcon } from '../icons'; import { FontIcon } from '../icons';
import useTheme from '../theme/useTheme';
const Wrapper = styled.div` const Wrapper = styled.div`
font-size: 15pt; font-size: 15pt;
padding: 15px; padding: 15px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
background-color: #eeffff; background-color: ${(props) => props.theme.modalheader_background};
`; `;
const CloseWrapper = styled.div` const CloseWrapper = styled.div`
font-size: 12pt; font-size: 12pt;
&:hover { &:hover {
background-color: #ccccff; background-color: ${(props) => props.theme.modalheader_background2};
} }
padding: 5px 10px; padding: 5px 10px;
border-radius: 10px; border-radius: 10px;
`; `;
export default function ModalHeader({ children, modalState }) { export default function ModalHeader({ children, modalState }) {
const theme = useTheme();
return ( return (
<Wrapper> <Wrapper theme={theme}>
<div>{children}</div> <div>{children}</div>
<CloseWrapper onClick={modalState.close}> <CloseWrapper onClick={modalState.close} theme={theme}>
<FontIcon icon="icon close" /> <FontIcon icon="icon close" />
</CloseWrapper> </CloseWrapper>
</Wrapper> </Wrapper>

View File

@@ -1,11 +1,13 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import moment from 'moment'; import moment from 'moment';
import useTheme from '../theme/useTheme';
const MainContainer = styled.div` const MainContainer = styled.div`
flex:1 flex: 1;
display:flex display: flex;
overflow-y: scroll overflow-y: scroll;
background-color: ${(props) => props.theme.gridbody_background};
`; `;
const StyledTable = styled.table` const StyledTable = styled.table`
@@ -14,28 +16,29 @@ const StyledTable = styled.table`
border-collapse: collapse; border-collapse: collapse;
`; `;
const StyledHeader = styled.th` const StyledHeader = styled.td`
text-align: left; text-align: left;
border-bottom: 2px solid #ddd; border-bottom: 2px solid ${(props) => props.theme.border};
background-color: ${(props) => props.theme.gridheader_background};
padding: 5px; padding: 5px;
`; `;
const StyledCell = styled.td` const StyledCell = styled.td`
border-top: 1px solid #ddd; border-top: 1px solid ${(props) => props.theme.border};
padding: 5px; padding: 5px;
`; `;
const StyledRow = styled.tr` const StyledRow = styled.tr`
color: ${(props) => color: ${(props) =>
// @ts-ignore // @ts-ignore
props.severity == 'error' ? 'red' : 'black'}; props.severity == 'error' ? props.theme.gridbody_font_red[5] : props.theme.gridbody_font1};
${(props) => ${(props) =>
// @ts-ignore // @ts-ignore
props.line != null && props.line != null &&
` `
&:hover { &:hover {
background-color: #ccc; background-color: ${props.theme.gridbody_background2};
} }
`} `}
`; `;
@@ -55,6 +58,7 @@ function MessagesView({ items, onMessageClick, showProcedure = false, showLine =
const handleClick = (row) => { const handleClick = (row) => {
if (onMessageClick) onMessageClick(row); if (onMessageClick) onMessageClick(row);
}; };
const theme = useTheme();
const mainDiv = React.useRef(null); const mainDiv = React.useRef(null);
@@ -68,31 +72,31 @@ function MessagesView({ items, onMessageClick, showProcedure = false, showLine =
const time0 = items[0] && new Date(items[0].time).getTime(); const time0 = items[0] && new Date(items[0].time).getTime();
return ( return (
<MainContainer ref={mainDiv}> <MainContainer ref={mainDiv} theme={theme}>
<StyledTable> <StyledTable theme={theme}>
<tr> <tr>
<StyledHeader>Number</StyledHeader> <StyledHeader theme={theme}>Number</StyledHeader>
<StyledHeader>Message</StyledHeader> <StyledHeader theme={theme}>Message</StyledHeader>
<StyledHeader>Time</StyledHeader> <StyledHeader theme={theme}>Time</StyledHeader>
<StyledHeader>Delta</StyledHeader> <StyledHeader theme={theme}>Delta</StyledHeader>
<StyledHeader>Duration</StyledHeader> <StyledHeader theme={theme}>Duration</StyledHeader>
{showProcedure && <StyledHeader>Procedure</StyledHeader>} {showProcedure && <StyledHeader theme={theme}>Procedure</StyledHeader>}
{showLine && <StyledHeader>Line</StyledHeader>} {showLine && <StyledHeader theme={theme}>Line</StyledHeader>}
</tr> </tr>
{items.map((row, index) => ( {items.map((row, index) => (
// @ts-ignore // @ts-ignore
<StyledRow key={index} severity={row.severity} line={row.line} onClick={() => handleClick(row)}> <StyledRow key={index} severity={row.severity} line={row.line} onClick={() => handleClick(row)} theme={theme}>
<StyledCell>{index + 1}</StyledCell> <StyledCell theme={theme}>{index + 1}</StyledCell>
<StyledCell>{row.message}</StyledCell> <StyledCell theme={theme}>{row.message}</StyledCell>
<StyledCell>{moment(row.time).format('HH:mm:ss')}</StyledCell> <StyledCell theme={theme}>{moment(row.time).format('HH:mm:ss')}</StyledCell>
<StyledCell>{formatDuration(new Date(row.time).getTime() - time0)}</StyledCell> <StyledCell theme={theme}>{formatDuration(new Date(row.time).getTime() - time0)}</StyledCell>
<StyledCell> <StyledCell theme={theme}>
{index > 0 {index > 0
? formatDuration(new Date(row.time).getTime() - new Date(items[index - 1].time).getTime()) ? formatDuration(new Date(row.time).getTime() - new Date(items[index - 1].time).getTime())
: 'n/a'} : 'n/a'}
</StyledCell> </StyledCell>
{showProcedure && <StyledCell>{row.procedure}</StyledCell>} {showProcedure && <StyledCell theme={theme}>{row.procedure}</StyledCell>}
{showLine && <StyledCell>{row.line}</StyledCell>} {showLine && <StyledCell theme={theme}>{row.line}</StyledCell>}
</StyledRow> </StyledRow>
))} ))}
</StyledTable> </StyledTable>

View File

@@ -10,6 +10,7 @@ const theme = {
aceEditorTheme: 'twilight', aceEditorTheme: 'twilight',
border: '#555', border: '#555',
border_background: '#555',
toolbar_background: '#333', toolbar_background: '#333',
content_background: '#333', content_background: '#333',
@@ -22,6 +23,9 @@ const theme = {
gridbody_background: '#000', gridbody_background: '#000',
scrollbar_background: '#444', scrollbar_background: '#444',
input_background: '#333', input_background: '#333',
modal_background: '#222',
modalheader_background: '#555',
button_background: '#337ab7',
statusBarBackground: '#00c', statusBarBackground: '#00c',
}; };

View File

@@ -8,6 +8,7 @@ const theme = {
aceEditorTheme: 'github', aceEditorTheme: 'github',
border: '#ccc', border: '#ccc',
border_background: '#ccc',
toolbar_background: '#eee', toolbar_background: '#eee',
content_background: '#eee', content_background: '#eee',
@@ -16,11 +17,14 @@ const theme = {
title_background: '#888', title_background: '#888',
manager_background: '#fff', manager_background: '#fff',
tabs_background: '#eee', tabs_background: '#eee',
gridheader_background: '#f6f7f9', gridheader_background: '#eee',
gridheader_type: 'light', gridheader_type: 'light',
gridbody_background: '#fff', gridbody_background: '#fff',
scrollbar_background: '#ddd', scrollbar_background: '#ddd',
input_background: '#fff', input_background: '#fff',
modal_background: '#fff',
modalheader_background: '#eff',
button_background: '#337ab7',
statusBarBackground: '#00c', statusBarBackground: '#00c',
}; };

View File

@@ -2,6 +2,7 @@ import React from 'react';
import _ from 'lodash'; import _ from 'lodash';
import styled from 'styled-components'; import styled from 'styled-components';
import keycodes from './keycodes'; import keycodes from './keycodes';
import useTheme from '../theme/useTheme';
const Table = styled.table` const Table = styled.table`
border-collapse: collapse; border-collapse: collapse;
@@ -17,15 +18,15 @@ const TableHeaderRow = styled.tr``;
const TableBodyRow = styled.tr` const TableBodyRow = styled.tr`
background-color: ${(props) => background-color: ${(props) =>
// @ts-ignore // @ts-ignore
props.isSelected ? '#ccccff' : ''}; props.isSelected ? props.theme.gridbody_background_blue[1] : props.theme.gridbody_background};
`; `;
const TableHeaderCell = styled.td` const TableHeaderCell = styled.td`
border: 1px solid #e8eef4; border: 1px solid ${(props) => props.theme.gridheader_background};
background-color: #e8eef4; background-color: ${(props) => props.theme.gridheader_background};
padding: 5px; padding: 5px;
`; `;
const TableBodyCell = styled.td` const TableBodyCell = styled.td`
border: 1px solid #e8eef4; border: 1px solid ${(props) => props.theme.gridbody_background2};
padding: 5px; padding: 5px;
`; `;
@@ -55,6 +56,7 @@ export default function TableControl({
const myTableRef = React.useRef(null); const myTableRef = React.useRef(null);
const currentTableRef = tableRef || myTableRef; const currentTableRef = tableRef || myTableRef;
const theme = useTheme();
React.useEffect(() => { React.useEffect(() => {
if (focusOnCreate) { if (focusOnCreate) {
@@ -62,7 +64,8 @@ export default function TableControl({
} }
}, []); }, []);
const handleKeyDown = React.useCallback((event) => { const handleKeyDown = React.useCallback(
(event) => {
if (event.keyCode == keycodes.downArrow) { if (event.keyCode == keycodes.downArrow) {
setSelectedIndex((i) => Math.min(i + 1, rows.length - 1)); setSelectedIndex((i) => Math.min(i + 1, rows.length - 1));
} }
@@ -70,7 +73,9 @@ export default function TableControl({
setSelectedIndex((i) => Math.max(0, i - 1)); setSelectedIndex((i) => Math.max(0, i - 1));
} }
if (onKeyDown) onKeyDown(event); if (onKeyDown) onKeyDown(event);
}, [setSelectedIndex, rows]); },
[setSelectedIndex, rows]
);
return ( return (
<Table <Table
@@ -83,7 +88,9 @@ export default function TableControl({
<TableHead> <TableHead>
<TableHeaderRow> <TableHeaderRow>
{columns.map((x) => ( {columns.map((x) => (
<TableHeaderCell key={x.fieldName}>{x.header}</TableHeaderCell> <TableHeaderCell key={x.fieldName} theme={theme}>
{x.header}
</TableHeaderCell>
))} ))}
</TableHeaderRow> </TableHeaderRow>
</TableHead> </TableHead>
@@ -91,6 +98,7 @@ export default function TableControl({
{rows.map((row, index) => ( {rows.map((row, index) => (
<TableBodyRow <TableBodyRow
key={index} key={index}
theme={theme}
// @ts-ignore // @ts-ignore
isSelected={index == selectedIndex} isSelected={index == selectedIndex}
onClick={ onClick={
@@ -103,7 +111,7 @@ export default function TableControl({
} }
> >
{columns.map((col) => ( {columns.map((col) => (
<TableBodyCell key={col.fieldName}>{format(row, col)}</TableBodyCell> <TableBodyCell key={col.fieldName} theme={theme}>{format(row, col)}</TableBodyCell>
))} ))}
</TableBodyRow> </TableBodyRow>
))} ))}

View File

@@ -15,6 +15,7 @@ import {
import useSocket from './SocketProvider'; import useSocket from './SocketProvider';
import getAsArray from './getAsArray'; import getAsArray from './getAsArray';
import axios from './axios'; import axios from './axios';
import useTheme from '../theme/useTheme';
export const FormRow = styled.div` export const FormRow = styled.div`
display: flex; display: flex;
@@ -115,9 +116,32 @@ export function FormRadioGroupItem({ name, text, value }) {
export function FormReactSelect({ options, name, isMulti = false, Component = Select, ...other }) { export function FormReactSelect({ options, name, isMulti = false, Component = Select, ...other }) {
const { setFieldValue, values } = useFormikContext(); const { setFieldValue, values } = useFormikContext();
const theme = useTheme();
return ( return (
<Component <Component
theme={(t) => ({
...t,
colors: {
...t.colors,
neutral0: theme.input_background,
neutral10: theme.input_background2,
neutral20: theme.input_background3,
neutral30: theme.input_background4,
neutral40: theme.input_font3,
neutral50: theme.input_font3,
neutral60: theme.input_font2,
neutral70: theme.input_font2,
neutral80: theme.input_font2,
neutral90: theme.input_font1,
primary: theme.input_background_blue[5],
primary75: theme.input_background_blue[3],
primary50: theme.input_background_blue[2],
primary25: theme.input_background_blue[0],
danger: theme.input_background_red[5],
dangerLight: theme.input_background_red[1],
},
})}
options={options} options={options}
value={ value={
isMulti isMulti

View File

@@ -2,40 +2,40 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import dimensions from '../theme/dimensions'; import dimensions from '../theme/dimensions';
import useTheme from '../theme/useTheme';
const ButtonInput = styled.input` const ButtonInput = styled.input`
// height: ${dimensions.toolBar.height - 5}px; // height: ${dimensions.toolBar.height - 5}px;
border: 1px solid #2e6da4; border: 1px solid ${(props) => props.theme.button_background2};
padding: 5px; padding: 5px;
margin: 2px; margin: 2px;
width: 100px; width: 100px;
//background-color: #777; background-color: ${(props) => props.theme.button_background};
background-color: #337ab7; color: ${(props) => props.theme.button_font1};
// border-color: #2e6da4;
color: white;
border-radius: 2px; border-radius: 2px;
${(props) => ${(props) =>
!props.disabled && !props.disabled &&
` `
&:hover { &:hover {
background-color: #286090; background-color: ${props.theme.button_background2};
} }
&:active:hover { &:active:hover {
background-color: #204d74; background-color: ${props.theme.button_background3};
} }
`} `}
${(props) => ${(props) =>
props.disabled && props.disabled &&
` `
background-color: #ccc; background-color: ${props.theme.button_background3};
color: gray; color: ${props.theme.button_font3} ;
`} `}
`; `;
// ${props.theme.button_background_gray[1]};
export default function FormStyledButton({ export default function FormStyledButton({
onClick = undefined, onClick = undefined,
type = 'button', type = 'button',
@@ -43,9 +43,11 @@ export default function FormStyledButton({
disabled = undefined, disabled = undefined,
...other ...other
}) { }) {
const theme = useTheme();
return ( return (
<ButtonInput <ButtonInput
type={type} type={type}
theme={theme}
onClick={ onClick={
onClick onClick
? () => { ? () => {

View File

@@ -32,7 +32,7 @@ background-color: ${(props) => props.theme.border};
height: ${dimensions.splitter.thickness}px; height: ${dimensions.splitter.thickness}px;
cursor: row-resize; cursor: row-resize;
&:hover { &:hover {
background-color: #aaa; background-color: ${(props) => props.theme.border_background2};
} }
`; `;
@@ -41,7 +41,7 @@ export const HorizontalSplitHandle = styled.div`
width: ${dimensions.splitter.thickness}px; width: ${dimensions.splitter.thickness}px;
cursor: col-resize; cursor: col-resize;
&:hover { &:hover {
background-color: #aaa; background-color: ${(props) => props.theme.border_background2};
} }
`; `;

View File

@@ -108,7 +108,7 @@ export default function ToolBar({ toolbarPortalRef }) {
Import data Import data
</ToolbarButton> </ToolbarButton>
<ToolbarButton onClick={switchTheme} icon="icon theme"> <ToolbarButton onClick={switchTheme} icon="icon theme">
Switch theme {currentTheme == 'dark' ? 'Light mode' : 'Dark mode'}
</ToolbarButton> </ToolbarButton>
<ToolbarContainer ref={toolbarPortalRef}></ToolbarContainer> <ToolbarContainer ref={toolbarPortalRef}></ToolbarContainer>

View File

@@ -9,6 +9,7 @@ import {
} from './WidgetStyles'; } from './WidgetStyles';
import { VerticalSplitHandle, useSplitterDrag } from './Splitter'; import { VerticalSplitHandle, useSplitterDrag } from './Splitter';
import useDimensions from '../utility/useDimensions'; import useDimensions from '../utility/useDimensions';
import useTheme from '../theme/useTheme';
export function WidgetColumnBarItem({ title, children, name, height = undefined, collapsed = false }) { export function WidgetColumnBarItem({ title, children, name, height = undefined, collapsed = false }) {
return <></>; return <></>;
@@ -16,6 +17,7 @@ export function WidgetColumnBarItem({ title, children, name, height = undefined,
function WidgetContainer({ widget, visible, splitterVisible, parentHeight, initialSize = undefined }) { function WidgetContainer({ widget, visible, splitterVisible, parentHeight, initialSize = undefined }) {
const [size, setSize] = React.useState(null); const [size, setSize] = React.useState(null);
const theme = useTheme();
const handleResizeDown = useSplitterDrag('clientY', (diff) => setSize((v) => v + diff)); const handleResizeDown = useSplitterDrag('clientY', (diff) => setSize((v) => v + diff));
@@ -33,7 +35,7 @@ function WidgetContainer({ widget, visible, splitterVisible, parentHeight, initi
<WidgetsOuterContainer style={splitterVisible ? { height: size } : null}> <WidgetsOuterContainer style={splitterVisible ? { height: size } : null}>
{widget.props.children} {widget.props.children}
</WidgetsOuterContainer> </WidgetsOuterContainer>
{splitterVisible && <VerticalSplitHandle onMouseDown={handleResizeDown} />} {splitterVisible && <VerticalSplitHandle onMouseDown={handleResizeDown} theme={theme} />}
</> </>
); );
} }