Skip to content

Commit

Permalink
fix(ui): incorrect open btn placement in OpenDialogInput errorneus state
Browse files Browse the repository at this point in the history
  • Loading branch information
korhaliv committed Oct 16, 2019
1 parent c7b1d96 commit 087b2c9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
23 changes: 10 additions & 13 deletions renderer/components/Form/OpenDialogButton.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import React from 'react'
import { Box } from 'rebass/styled-components'
import styled from 'styled-components'
import Copy from 'components/Icon/FolderOpen'
import { Button } from 'components/UI'

const CustomButton = styled(Button)`
margin-left: -46px;
height: 45px;
margin-top: 1px;
padding: 0;
border-radius: 0 5px 5px 0;
overflow: hidden;
z-index: 1;
`

const OpenDialogButton = props => (
<CustomButton type="button" variant="secondary" {...props}>
<Button
height={44}
ml={-47}
p={0}
sx={{ overflow: 'hidden', zIndex: 1, borderRadius: '0 5px 5px 0' }}
type="button"
variant="secondary"
{...props}
>
<Box bg="secondaryColor" p={3}>
<Copy />
</Box>
</CustomButton>
</Button>
)

export default OpenDialogButton
8 changes: 5 additions & 3 deletions renderer/components/Form/OpenDialogInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ const InnerInput = styled(BasicInput)`
`

const OpenDialogInput = props => {
const { mode, ...rest } = props
const { mode, label, ...rest } = props
const [spaceProps, otherProps] = extractSpaceProps(rest)
return (
<WithOpenDialog
render={({ openDialog }) => (
<Flex alignItems="center" {...spaceProps}>
<InnerInput width={1} {...otherProps} />
<Flex alignItems="flex" {...spaceProps}>
<InnerInput width={1} {...otherProps} label={label} />
<OpenDialogButton
mt={label ? 23 : '1px'}
onClick={async () => {
const result = await openDialog(mode)
// set value only if something was selected to avoid
Expand All @@ -47,6 +48,7 @@ OpenDialogInput.propTypes = {
// electron showOpenDialog feature flags
// https://electronjs.org/docs/api/dialog
// options.properties
label: PropTypes.node,
mode: PropTypes.string,
}

Expand Down

0 comments on commit 087b2c9

Please sign in to comment.