Skip to content
This repository was archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #605 from dat-land/fix/can-be-title-chenging
Browse files Browse the repository at this point in the history
fix: Shadow when editing the title to cover the full screen.
  • Loading branch information
martinheidegger authored Nov 30, 2018
2 parents fa0025a + c3698de commit d204cf3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/actions/dat-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ export default class DatMiddleware {
this.listeners.forEach(listener => listener(action))
}

async updateTitle ({ key, editValue }) {
async updateTitle ({ key, title }) {
const dat = this.dats[key]
const filePath = joinPath(dat.path, 'dat.json')
const metadata = { ...dat.dat.metadata, title: editValue }
const metadata = { ...dat.dat.metadata, title: title }

try {
await writeFile(filePath, JSON.stringify(metadata))
Expand Down
11 changes: 8 additions & 3 deletions app/components/title-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import Icon from './icon'
import { Plain as PlainButton, Green as GreenButton } from './button'

const Overlay = styled.div`
position: absolute;
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.2);
z-index: 1;
`

const EditableFieldWrapper = styled.div`
Expand All @@ -36,6 +37,10 @@ const EditableFieldWrapper = styled.div`
}
`

const ActiveEditableFieldWrapper = styled(EditableFieldWrapper)`
z-index: 1;
`

const InputFieldStyle = styled.input`
:focus {
outline: none;
Expand Down Expand Up @@ -109,7 +114,7 @@ class TitleField extends Component {
return (
<div onClick={e => e.stopPropagation()}>
<Overlay onClick={() => this.cancel()} />
<EditableFieldWrapper className='bg-white nt1 nb1 nl1 shadow-1 flex justify-between'>
<ActiveEditableFieldWrapper className='bg-white nt1 nb1 nl1 shadow-1 flex justify-between'>
{/* why innerRef in following component? check here - styled-components/styled-components#102 */}
<InputField
className='bn f6 pl1 normal w-100'
Expand All @@ -122,7 +127,7 @@ class TitleField extends Component {
) : (
<PlainButton onClick={() => this.cancel()}>Save</PlainButton>
)}
</EditableFieldWrapper>
</ActiveEditableFieldWrapper>
</div>
)
}
Expand Down

0 comments on commit d204cf3

Please sign in to comment.