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

fix: Shadow when editing the title to cover the full screen. #605

Merged
merged 2 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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