mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 06:06:01 +00:00
button redesign
This commit is contained in:
@@ -8,6 +8,7 @@ import databaseAppObject from '../appobj/databaseAppObject';
|
||||
import { useSetCurrentDatabase, useCurrentDatabase } from '../utility/globalState';
|
||||
import tableAppObject from '../appobj/tableAppObject';
|
||||
import theme from '../theme';
|
||||
import InlineButton from './InlineButton';
|
||||
|
||||
const SearchBoxWrapper = styled.div`
|
||||
display: flex;
|
||||
@@ -38,13 +39,6 @@ const InnerContainer = styled.div`
|
||||
width: ${theme.leftPanel.width}px;
|
||||
`;
|
||||
|
||||
const Button = styled.button`
|
||||
// -webkit-appearance: none;
|
||||
// -moz-appearance: none;
|
||||
// appearance: none;
|
||||
// width: 50px;
|
||||
`;
|
||||
|
||||
const Input = styled.input`
|
||||
flex: 1;
|
||||
min-width: 90px;
|
||||
@@ -76,7 +70,7 @@ function ConnectionList() {
|
||||
<>
|
||||
<SearchBoxWrapper>
|
||||
<Input type="text" placeholder="Search connection" value={filter} onChange={e => setFilter(e.target.value)} />
|
||||
<Button>Refresh</Button>
|
||||
<InlineButton>Refresh</InlineButton>
|
||||
</SearchBoxWrapper>
|
||||
|
||||
<InnerContainer>
|
||||
@@ -102,7 +96,7 @@ function SqlObjectList({ conid, database }) {
|
||||
value={filter}
|
||||
onChange={e => setFilter(e.target.value)}
|
||||
/>
|
||||
<Button>Refresh</Button>
|
||||
<InlineButton>Refresh</InlineButton>
|
||||
</SearchBoxWrapper>
|
||||
<InnerContainer>
|
||||
<AppObjectList
|
||||
|
||||
18
packages/web/src/widgets/DropDownButton.js
Normal file
18
packages/web/src/widgets/DropDownButton.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import { showMenu } from '../modals/DropDownMenu';
|
||||
import InlineButton from './InlineButton';
|
||||
|
||||
export default function DropDownButton({ children }) {
|
||||
const buttonRef = React.useRef(null);
|
||||
|
||||
const handleShowMenu = () => {
|
||||
const rect = buttonRef.current.getBoundingClientRect();
|
||||
showMenu(rect.left, rect.bottom, children);
|
||||
};
|
||||
|
||||
return (
|
||||
<InlineButton buttonRef={buttonRef} onClick={handleShowMenu} square>
|
||||
<i className="fas fa-chevron-down" />
|
||||
</InlineButton>
|
||||
);
|
||||
}
|
||||
86
packages/web/src/widgets/InlineButton.js
Normal file
86
packages/web/src/widgets/InlineButton.js
Normal file
@@ -0,0 +1,86 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import theme from '../theme';
|
||||
|
||||
const ButtonDiv = styled.div`
|
||||
//box-shadow: 3px 4px 0px 0px #899599;
|
||||
background: linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
|
||||
background-color: #ededed;
|
||||
//border-radius: 15px;
|
||||
border: 1px solid #bbb;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
// color: #3a8a9e;
|
||||
// color: gray;
|
||||
// font-family: Arial;
|
||||
vertical-align: middle;
|
||||
color: black;
|
||||
font-size: 12px;
|
||||
padding: 3px;
|
||||
margin: 0;
|
||||
// padding: 7px 25px;
|
||||
text-decoration: none;
|
||||
// text-shadow: 0px 1px 0px #e1e2ed;
|
||||
&:hover {
|
||||
border: 1px solid #777;
|
||||
}
|
||||
&:active:hover {
|
||||
background: linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
|
||||
background-color: #bab1ba;
|
||||
}
|
||||
display: flex;
|
||||
|
||||
${props =>
|
||||
props.square &&
|
||||
`
|
||||
width: 18px;
|
||||
`}
|
||||
`;
|
||||
|
||||
const InnerDiv = styled.div`
|
||||
margin: auto;
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
`;
|
||||
|
||||
// ${props =>
|
||||
// !props.disabled &&
|
||||
// `
|
||||
// &:hover {
|
||||
// background-color: #286090;
|
||||
// }
|
||||
|
||||
// &:active:hover {
|
||||
// background-color: #204d74;
|
||||
// }
|
||||
// `}
|
||||
|
||||
// ${props =>
|
||||
// props.disabled &&
|
||||
// `
|
||||
// background-color: #ccc;
|
||||
// color: gray;
|
||||
// `}
|
||||
|
||||
export default function InlineButton({
|
||||
children,
|
||||
onClick = undefined,
|
||||
buttonRef = undefined,
|
||||
disabled = undefined,
|
||||
square = false,
|
||||
}) {
|
||||
return (
|
||||
<ButtonDiv
|
||||
className="buttonLike"
|
||||
ref={buttonRef}
|
||||
onClick={() => {
|
||||
if (!disabled && onClick) onClick();
|
||||
}}
|
||||
disabled={disabled}
|
||||
square={square}
|
||||
>
|
||||
<InnerDiv>{children}</InnerDiv>
|
||||
</ButtonDiv>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
// @ts-nocheck
|
||||
import ReactDOM from 'react-dom';
|
||||
import React from 'react';
|
||||
import useModalState from '../modals/useModalState';
|
||||
import ConnectionModal from '../modals/ConnectionModal';
|
||||
import styled from 'styled-components';
|
||||
import theme from '../theme';
|
||||
import { useOpenedTabs } from '../utility/globalState';
|
||||
|
||||
const ButtonDiv = styled.div`
|
||||
// height: ${theme.toolBar.height - 5}px;
|
||||
|
||||
Reference in New Issue
Block a user