-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from oslabs-beta/seeqrv5
Merging SeeQR version 5
- Loading branch information
Showing
19 changed files
with
426 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react'; | ||
import { ButtonGroup, Button } from '@material-ui/core/'; | ||
import styled from 'styled-components'; | ||
import { ipcRenderer } from 'electron'; | ||
import { AppState } from '../../types'; | ||
import { selectedColor, textColor, defaultMargin } from '../../style-variables'; | ||
import { sendFeedback } from '../../lib/utils'; | ||
|
||
const ViewBtnGroup = styled(ButtonGroup)` | ||
margin: ${defaultMargin} 5px; | ||
position: fixed; | ||
bottom: 0px; | ||
width: 300px; | ||
`; | ||
|
||
interface ViewButtonProps { | ||
$isSelected: boolean; | ||
} | ||
|
||
const ViewButton = styled(Button)` | ||
background: ${({ $isSelected }: ViewButtonProps) => | ||
$isSelected ? selectedColor : textColor}; | ||
`; | ||
|
||
|
||
type ViewSelectorProps = Pick<AppState, 'selectedView' | 'setSelectedView' | 'setSelectedDb' | 'selectedDb'>; | ||
|
||
/** | ||
* Selector for view on sidebar. Updates App state with selected view | ||
*/ | ||
const BottomButtons = ({ selectedView, setSelectedView, setSelectedDb, selectedDb}: ViewSelectorProps) => ( | ||
<ViewBtnGroup variant="contained" fullWidth> | ||
<ViewButton | ||
onClick={() => { | ||
setSelectedView('newSchemaView'); | ||
setSelectedDb(''); | ||
|
||
ipcRenderer | ||
.invoke('select-db', '') | ||
.catch(() => | ||
sendFeedback({ | ||
type: 'error', | ||
message: `Database connection error` | ||
}) | ||
) | ||
}} | ||
$isSelected={ | ||
selectedView === 'newSchemaView' || selectedView === 'compareView' | ||
} | ||
> | ||
Create New Database | ||
</ViewButton> | ||
</ViewBtnGroup> | ||
); | ||
export default BottomButtons; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.