Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New features #13

Closed
wants to merge 3 commits into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
renderer
node_modules
.DS_Store
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"main": "main/index.js",
"scripts": {
"start": "yarn prepare && electron main/index.js",
"build": "build",
"pack": "build --dir",
"build": "electron-builder",
"pack": "electron-builder --dir",
"prepare": "babel src -d renderer",
"watch": "babel src -d renderer -w"
},
Expand All @@ -37,7 +37,7 @@
"build": {
"appId": "io.blocks",
"productName": "Blocks",
"copyright": "Β© 2019 Blocks contributores. All rights reserved",
"copyright": "Β© 2019 Blocks contributors. All rights reserved",
"mac": {
"category": "public.app-category.developer-tools"
},
Expand Down
28 changes: 27 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { remote, ipcRenderer } from 'electron'
import { jsx, Styled } from 'theme-ui'
import { render } from 'react-dom'
import { Editor, serializer, stringifyMDX } from '@blocks/editor'
import { Folder, FileText } from 'react-feather'
import { Folder, FileText, ArrowLeft } from 'react-feather'
import debounce from 'lodash.debounce'

import Layout from './layout'
Expand Down Expand Up @@ -56,6 +56,8 @@ const App = () => {
}, [openFilePathname])

if (openFilePathname && openFileContents) {
const parentDir = getParentDirectory(openFilePathname)

return (
<Styled.root
css={{
Expand All @@ -66,6 +68,30 @@ const App = () => {
marginTop: '40px'
}}
>
<Styled.a
css={{
display: 'flex',
alignItems: 'center',
cursor: 'pointer',
marginBottom: '2px'
}}
onClick={() => {
handleFileListSelection(parentDir)
}}
>
<ArrowLeft />
<span sx={{ ml: 2 }}>Back</span>
</Styled.a>
<Styled.p
css={{
display: 'flex',
alignItems: 'center',
marginBottom: '20px'
}}
>
<FileText />
<span sx={{ ml: 2 }}>{openFilePathname}</span>
</Styled.p>
<Editor
initialValue={openFileContents}
onChange={({ value }) => {
Expand Down