mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 02:56:01 +00:00
modal styles
This commit is contained in:
@@ -99,7 +99,7 @@ export default function TableDataGrid({
|
|||||||
..._.fromPairs(
|
..._.fromPairs(
|
||||||
reference.columns.map((col) => [
|
reference.columns.map((col) => [
|
||||||
col.refName,
|
col.refName,
|
||||||
selectedRows.map((x) => getFilterValueExpression(x[col.baseName])).join(','),
|
selectedRows.map((x) => getFilterValueExpression(x[col.baseName])).join(', '),
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
body {
|
body {
|
||||||
font-family: -apple-system,BlinkMacSystemFont,Segoe WPC,Segoe UI,HelveticaNeue-Light,Ubuntu,Droid Sans,sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, Segoe WPC, Segoe UI, HelveticaNeue-Light, Ubuntu, Droid Sans,
|
||||||
|
sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
/* font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
/* font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||||
@@ -10,6 +11,14 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
|
||||||
monospace;
|
}
|
||||||
|
|
||||||
|
.RactModalOverlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #00000080;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ModalBase from './ModalBase';
|
import ModalBase from './ModalBase';
|
||||||
import { FormButtonRow } from '../utility/forms';
|
|
||||||
import FormStyledButton from '../widgets/FormStyledButton';
|
import FormStyledButton from '../widgets/FormStyledButton';
|
||||||
import styled from 'styled-components';
|
import ModalFooter from './ModalFooter';
|
||||||
|
import ModalContent from './ModalContent';
|
||||||
const MessageWrapper = styled.div`
|
|
||||||
margin: 20px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default function ConfirmModal({ message, modalState, onConfirm }) {
|
export default function ConfirmModal({ message, modalState, onConfirm }) {
|
||||||
return (
|
return (
|
||||||
<ModalBase modalState={modalState}>
|
<ModalBase modalState={modalState}>
|
||||||
<MessageWrapper>{message}</MessageWrapper>
|
<ModalContent>{message}</ModalContent>
|
||||||
|
|
||||||
<FormButtonRow>
|
<ModalFooter>
|
||||||
<FormStyledButton
|
<FormStyledButton
|
||||||
value="OK"
|
value="OK"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -22,7 +18,7 @@ export default function ConfirmModal({ message, modalState, onConfirm }) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<FormStyledButton type="button" value="Close" onClick={modalState.close} />
|
<FormStyledButton type="button" value="Close" onClick={modalState.close} />
|
||||||
</FormButtonRow>
|
</ModalFooter>
|
||||||
</ModalBase>
|
</ModalBase>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import FormStyledButton from '../widgets/FormStyledButton';
|
|||||||
import SqlEditor from '../sqleditor/SqlEditor';
|
import SqlEditor from '../sqleditor/SqlEditor';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import keycodes from '../utility/keycodes';
|
import keycodes from '../utility/keycodes';
|
||||||
|
import ModalHeader from './ModalHeader';
|
||||||
|
import ModalContent from './ModalContent';
|
||||||
|
import ModalFooter from './ModalFooter';
|
||||||
|
|
||||||
const SqlWrapper = styled.div`
|
const SqlWrapper = styled.div`
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -22,12 +25,14 @@ export default function ConfirmSqlModal({ modalState, sql, engine, onConfirm })
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<ModalBase modalState={modalState}>
|
<ModalBase modalState={modalState}>
|
||||||
<h2>Save changes</h2>
|
<ModalHeader modalState={modalState}>Save changes</ModalHeader>
|
||||||
|
<ModalContent>
|
||||||
<SqlWrapper>
|
<SqlWrapper>
|
||||||
<SqlEditor value={sql} engine={engine} focusOnCreate onKeyDown={handleKeyDown} readOnly />
|
<SqlEditor value={sql} engine={engine} focusOnCreate onKeyDown={handleKeyDown} readOnly />
|
||||||
</SqlWrapper>
|
</SqlWrapper>
|
||||||
|
</ModalContent>
|
||||||
|
|
||||||
<FormButtonRow>
|
<ModalFooter>
|
||||||
<FormStyledButton
|
<FormStyledButton
|
||||||
value="OK"
|
value="OK"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -36,7 +41,7 @@ export default function ConfirmSqlModal({ modalState, sql, engine, onConfirm })
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<FormStyledButton type="button" value="Close" onClick={modalState.close} />
|
<FormStyledButton type="button" value="Close" onClick={modalState.close} />
|
||||||
</FormButtonRow>
|
</ModalFooter>
|
||||||
</ModalBase>
|
</ModalBase>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,28 +4,32 @@ import ModalBase from './ModalBase';
|
|||||||
import { FormButtonRow, FormButton, FormTextField, FormSelectField, FormSubmit } from '../utility/forms';
|
import { FormButtonRow, FormButton, FormTextField, FormSelectField, FormSubmit } from '../utility/forms';
|
||||||
import { TextField } from '../utility/inputs';
|
import { TextField } from '../utility/inputs';
|
||||||
import { Formik, Form } from 'formik';
|
import { Formik, Form } from 'formik';
|
||||||
|
import ModalHeader from './ModalHeader';
|
||||||
|
import ModalFooter from './ModalFooter';
|
||||||
|
import ModalContent from './ModalContent';
|
||||||
// import FormikForm from '../utility/FormikForm';
|
// import FormikForm from '../utility/FormikForm';
|
||||||
|
|
||||||
export default function ConnectionModal({ modalState, connection = undefined }) {
|
export default function ConnectionModal({ modalState, connection = undefined }) {
|
||||||
const [sqlConnectResult, setSqlConnectResult] = React.useState('Not connected');
|
const [sqlConnectResult, setSqlConnectResult] = React.useState('Not connected');
|
||||||
|
|
||||||
const handleTest = async values => {
|
const handleTest = async (values) => {
|
||||||
const resp = await axios.post('connections/test', values);
|
const resp = await axios.post('connections/test', values);
|
||||||
const { error, version } = resp.data;
|
const { error, version } = resp.data;
|
||||||
|
|
||||||
setSqlConnectResult(error || version);
|
setSqlConnectResult(error || version);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = async values => {
|
const handleSubmit = async (values) => {
|
||||||
const resp = await axios.post('connections/save', values);
|
const resp = await axios.post('connections/save', values);
|
||||||
|
|
||||||
modalState.close();
|
modalState.close();
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<ModalBase modalState={modalState}>
|
<ModalBase modalState={modalState}>
|
||||||
<h2>{connection ? 'Edit connection' : 'Add connection'}</h2>
|
<ModalHeader modalState={modalState}>{connection ? 'Edit connection' : 'Add connection'}</ModalHeader>
|
||||||
<Formik onSubmit={handleSubmit} initialValues={connection || { server: 'localhost', engine: 'mssql' }}>
|
<Formik onSubmit={handleSubmit} initialValues={connection || { server: 'localhost', engine: 'mssql' }}>
|
||||||
<Form>
|
<Form>
|
||||||
|
<ModalContent>
|
||||||
<FormSelectField label="Database engine" name="engine">
|
<FormSelectField label="Database engine" name="engine">
|
||||||
<option value="mssql">Microsoft SQL Server</option>
|
<option value="mssql">Microsoft SQL Server</option>
|
||||||
<option value="mysql">MySQL</option>
|
<option value="mysql">MySQL</option>
|
||||||
@@ -36,14 +40,15 @@ export default function ConnectionModal({ modalState, connection = undefined })
|
|||||||
<FormTextField label="User" name="user" />
|
<FormTextField label="User" name="user" />
|
||||||
<FormTextField label="Password" name="password" />
|
<FormTextField label="Password" name="password" />
|
||||||
<FormTextField label="Display name" name="displayName" />
|
<FormTextField label="Display name" name="displayName" />
|
||||||
|
<div>Connect result: {sqlConnectResult}</div>
|
||||||
|
</ModalContent>
|
||||||
|
|
||||||
<FormButtonRow>
|
<ModalFooter>
|
||||||
<FormButton text="Test" onClick={handleTest} />
|
<FormButton text="Test" onClick={handleTest} />
|
||||||
<FormSubmit text="Save" />
|
<FormSubmit text="Save" />
|
||||||
</FormButtonRow>
|
</ModalFooter>
|
||||||
</Form>
|
</Form>
|
||||||
</Formik>
|
</Formik>
|
||||||
<div>Connect result: {sqlConnectResult}</div>
|
|
||||||
</ModalBase>
|
</ModalBase>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import FormStyledButton from '../widgets/FormStyledButton';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { FontIcon } from '../icons';
|
import { FontIcon } from '../icons';
|
||||||
import { FormButtonRow } from '../utility/forms';
|
import { FormButtonRow } from '../utility/forms';
|
||||||
|
import ModalHeader from './ModalHeader';
|
||||||
|
import ModalFooter from './ModalFooter';
|
||||||
|
import ModalContent from './ModalContent';
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
display:flex
|
display:flex
|
||||||
@@ -18,16 +21,18 @@ const IconWrapper = styled.div`
|
|||||||
export default function ErrorMessageModal({ modalState, title = 'Error', message }) {
|
export default function ErrorMessageModal({ modalState, title = 'Error', message }) {
|
||||||
return (
|
return (
|
||||||
<ModalBase modalState={modalState}>
|
<ModalBase modalState={modalState}>
|
||||||
<h2>{title}</h2>
|
<ModalHeader modalState={modalState}>{title}</ModalHeader>
|
||||||
|
<ModalContent>
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<IconWrapper>
|
<IconWrapper>
|
||||||
<FontIcon icon="fas fa-times-circle red" />
|
<FontIcon icon="fas fa-times-circle red" />
|
||||||
</IconWrapper>
|
</IconWrapper>
|
||||||
{message}
|
{message}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
<FormButtonRow>
|
</ModalContent>
|
||||||
|
<ModalFooter>
|
||||||
<FormStyledButton type="button" value="Close" onClick={modalState.close} />
|
<FormStyledButton type="button" value="Close" onClick={modalState.close} />
|
||||||
</FormButtonRow>
|
</ModalFooter>
|
||||||
</ModalBase>
|
</ModalBase>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,17 +24,34 @@ const StyledModal = styled(Modal)`
|
|||||||
webkitoverflowscrolling: touch;
|
webkitoverflowscrolling: touch;
|
||||||
borderradius: 4px;
|
borderradius: 4px;
|
||||||
outline: none;
|
outline: none;
|
||||||
padding: 20px;
|
|
||||||
|
|
||||||
width: 50%;
|
width: 50%;
|
||||||
max-width: 900px;
|
max-width: 900px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
margin-top: 15vh;
|
margin-top: 15vh;
|
||||||
|
|
||||||
|
// z-index:1200;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const ModalContent = styled.div`
|
||||||
|
padding: 20px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default function ModalBase({ modalState, children }) {
|
export default function ModalBase({ modalState, children }) {
|
||||||
return (
|
return (
|
||||||
<StyledModal isOpen={modalState.isOpen} onRequestClose={modalState.close}>
|
<StyledModal
|
||||||
|
isOpen={modalState.isOpen}
|
||||||
|
onRequestClose={modalState.close}
|
||||||
|
overlayClassName="RactModalOverlay"
|
||||||
|
// style={{
|
||||||
|
// overlay: {
|
||||||
|
// backgroundColor: '#000',
|
||||||
|
// opacity: 0.5,
|
||||||
|
// zIndex: 1000,
|
||||||
|
// },
|
||||||
|
// zIndex: 1200,
|
||||||
|
// }}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</StyledModal>
|
</StyledModal>
|
||||||
);
|
);
|
||||||
|
|||||||
12
packages/web/src/modals/ModalContent.js
Normal file
12
packages/web/src/modals/ModalContent.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
padding: 15px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default function ModalContent({ children }) {
|
||||||
|
return <Wrapper>{children}</Wrapper>;
|
||||||
|
}
|
||||||
11
packages/web/src/modals/ModalFooter.js
Normal file
11
packages/web/src/modals/ModalFooter.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
padding: 15px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default function ModalFooter({ children }) {
|
||||||
|
return <Wrapper>{children}</Wrapper>;
|
||||||
|
}
|
||||||
27
packages/web/src/modals/ModalHeader.js
Normal file
27
packages/web/src/modals/ModalHeader.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
font-size: 15pt;
|
||||||
|
padding: 15px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const CloseWrapper = styled.div`
|
||||||
|
font-size: 12pt;
|
||||||
|
&:hover {
|
||||||
|
background-color: #blue;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default function ModalHeader({ children, modalState }) {
|
||||||
|
return (
|
||||||
|
<Wrapper>
|
||||||
|
<div>{children}</div>
|
||||||
|
<CloseWrapper onClick={modalState.close}>
|
||||||
|
<i className="fas fa-times" />
|
||||||
|
</CloseWrapper>
|
||||||
|
</Wrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -5,6 +5,9 @@ import { FormButtonRow, FormButton, FormTextField, FormSelectField, FormSubmit }
|
|||||||
import { TextField } from '../utility/inputs';
|
import { TextField } from '../utility/inputs';
|
||||||
import { Formik, Form } from 'formik';
|
import { Formik, Form } from 'formik';
|
||||||
import { useSetSavedSqlFiles } from '../utility/globalState';
|
import { useSetSavedSqlFiles } from '../utility/globalState';
|
||||||
|
import ModalHeader from './ModalHeader';
|
||||||
|
import ModalContent from './ModalContent';
|
||||||
|
import ModalFooter from './ModalFooter';
|
||||||
// import FormikForm from '../utility/FormikForm';
|
// import FormikForm from '../utility/FormikForm';
|
||||||
|
|
||||||
export default function SaveSqlFileModal({ storageKey, modalState, name, onSave = undefined }) {
|
export default function SaveSqlFileModal({ storageKey, modalState, name, onSave = undefined }) {
|
||||||
@@ -23,14 +26,15 @@ export default function SaveSqlFileModal({ storageKey, modalState, name, onSave
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<ModalBase modalState={modalState}>
|
<ModalBase modalState={modalState}>
|
||||||
<h2>Save SQL file</h2>
|
<ModalHeader modalState={modalState}>Save SQL file</ModalHeader>
|
||||||
<Formik onSubmit={handleSubmit} initialValues={{ name }}>
|
<Formik onSubmit={handleSubmit} initialValues={{ name }}>
|
||||||
<Form>
|
<Form>
|
||||||
|
<ModalContent>
|
||||||
<FormTextField label="File name" name="name" />
|
<FormTextField label="File name" name="name" />
|
||||||
|
</ModalContent>
|
||||||
<FormButtonRow>
|
<ModalFooter>
|
||||||
<FormSubmit text="Save" />
|
<FormSubmit text="Save" />
|
||||||
</FormButtonRow>
|
</ModalFooter>
|
||||||
</Form>
|
</Form>
|
||||||
</Formik>
|
</Formik>
|
||||||
</ModalBase>
|
</ModalBase>
|
||||||
|
|||||||
Reference in New Issue
Block a user