Skip to content

Commit 725bf2a

Browse files
committed
Merge branch 'master' into filter-tags-and-folders
# Conflicts: # browser/main/SideNav/PreferenceButton.styl # browser/main/SideNav/SideNav.styl
2 parents f1d03ac + 051ce9e commit 725bf2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1555
-2637
lines changed

browser/components/MarkdownPreview.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import yaml from 'js-yaml'
2121
import { render } from 'react-dom'
2222
import Carousel from 'react-image-carousel'
2323
import ConfigManager from '../main/lib/ConfigManager'
24+
import uiThemes from 'browser/lib/ui-themes'
2425
import i18n from 'browser/lib/i18n'
2526

2627
const { remote, shell } = require('electron')
@@ -488,15 +489,7 @@ export default class MarkdownPreview extends React.Component {
488489
getScrollBarStyle () {
489490
const { theme } = this.props
490491

491-
switch (theme) {
492-
case 'dark':
493-
case 'solarized-dark':
494-
case 'monokai':
495-
case 'dracula':
496-
return scrollBarDarkStyle
497-
default:
498-
return scrollBarStyle
499-
}
492+
return uiThemes.some(item => item.name === theme && item.isDark) ? scrollBarDarkStyle : scrollBarStyle
500493
}
501494

502495
componentDidMount () {
@@ -1142,7 +1135,17 @@ export default class MarkdownPreview extends React.Component {
11421135
}
11431136

11441137
// other case
1145-
shell.openExternal(href)
1138+
this.openExternal(href)
1139+
}
1140+
1141+
openExternal (href) {
1142+
try {
1143+
const success = shell.openExternal(href) || shell.openExternal(decodeURI(href))
1144+
if (!success) console.error('failed to open url ' + href)
1145+
} catch (e) {
1146+
// URI Error threw from decodeURI
1147+
console.error(e)
1148+
}
11461149
}
11471150

11481151
render () {

browser/components/MarkdownSplitEditor.styl

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,14 @@
1616
z-index 10
1717
cursor col-resize
1818

19-
body[data-theme="dark"]
20-
.root
21-
.slider
22-
border-left 1px solid $ui-dark-borderColor
19+
apply-theme(theme)
20+
body[data-theme={theme}]
21+
.root
22+
.slider
23+
border-left 1px solid get-theme-var(theme, 'borderColor')
2324

24-
body[data-theme="solarized-dark"]
25-
.root
26-
.slider
27-
border-left 1px solid $ui-solarized-dark-borderColor
25+
for theme in 'dark' 'dracula' 'solarized-dark'
26+
apply-theme(theme)
2827

29-
body[data-theme="monokai"]
30-
.root
31-
.slider
32-
border-left 1px solid $ui-monokai-borderColor
33-
34-
body[data-theme="dracula"]
35-
.root
36-
.slider
37-
border-left 1px solid $ui-dracula-borderColor
28+
for theme in $themes
29+
apply-theme(theme)

browser/components/NavToggleButton.styl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@
1717
body[data-theme="white"]
1818
navWhiteButtonColor()
1919

20-
body[data-theme="dark"]
21-
.navToggle
22-
&:hover
23-
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
20+
apply-theme(theme)
21+
body[data-theme={theme}]
22+
.navToggle:hover
23+
background-color alpha(get-theme-var(theme, 'button--active-backgroundColor'), 20%)
24+
border 1px solid get-theme-var(theme, 'button--active-backgroundColor')
2425
transition 0.15s
25-
color $ui-dark-text-color
26+
color get-theme-var(theme, 'text-color')
2627

28+
for theme in 'dark' 'dracula' 'solarized-dark'
29+
apply-theme(theme)
30+
31+
for theme in $themes
32+
apply-theme(theme)

browser/components/NoteItem.styl

Lines changed: 66 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ body[data-theme="dark"]
194194
color $ui-dark-text-color
195195
.item-bottom-tagList-item
196196
transition 0.15s
197-
background-color alpha(#fff, 20%)
197+
background-color alpha($ui-dark-tagList-backgroundColor, 20%)
198198
color $ui-dark-text-color
199199
&:active
200200
transition 0.15s
@@ -207,7 +207,7 @@ body[data-theme="dark"]
207207
color $ui-dark-text-color
208208
.item-bottom-tagList-item
209209
transition 0.15s
210-
background-color alpha(white, 10%)
210+
background-color alpha($ui-dark-tagList-backgroundColor, 10%)
211211
color $ui-dark-text-color
212212

213213
.item-wrapper
@@ -223,13 +223,13 @@ body[data-theme="dark"]
223223
.item-bottom-time
224224
color $ui-dark-text-color
225225
.item-bottom-tagList-item
226-
background-color alpha(white, 10%)
226+
background-color alpha($ui-dark-tagList-backgroundColor, 10%)
227227
color $ui-dark-text-color
228228
&:hover
229229
background-color alpha($ui-dark-button--active-backgroundColor, 60%)
230-
color #c0392b
230+
color $ui-dark-button--hover-color
231231
.item-bottom-tagList-item
232-
background-color alpha(#fff, 20%)
232+
background-color alpha($ui-dark-tagList-backgroundColor, 20%)
233233

234234
.item-title
235235
color $ui-inactive-text-color
@@ -322,148 +322,82 @@ body[data-theme="solarized-dark"]
322322
color $ui-inactive-text-color
323323
vertical-align middle
324324

325-
body[data-theme="monokai"]
326-
.root
327-
border-color $ui-monokai-borderColor
328-
background-color $ui-monokai-noteList-backgroundColor
325+
apply-theme(theme)
326+
body[data-theme={theme}]
327+
.root
328+
border-color get-theme-var(theme, 'borderColor')
329+
background-color get-theme-var(theme, 'noteList-backgroundColor')
329330

330-
.item
331-
border-color $ui-monokai-borderColor
332-
background-color $ui-monokai-noteList-backgroundColor
333-
&:hover
334-
transition 0.15s
335-
// background-color alpha($ui-monokai-noteList-backgroundColor, 20%)
336-
color $ui-monokai-text-color
337-
.item-title
338-
.item-title-icon
339-
.item-bottom-time
331+
.item
332+
border-color get-theme-var(theme, 'borderColor')
333+
background-color get-theme-var(theme, 'noteList-backgroundColor')
334+
&:hover
340335
transition 0.15s
341-
color $ui-monokai-text-color
342-
.item-bottom-tagList-item
336+
// background-color alpha(get-theme-var(theme, 'noteList-backgroundColor'), 20%)
337+
color get-theme-var(theme, 'text-color')
338+
.item-title
339+
.item-title-icon
340+
.item-bottom-time
341+
transition 0.15s
342+
color get-theme-var(theme, 'text-color')
343+
.item-bottom-tagList-item
344+
transition 0.15s
345+
background-color alpha(get-theme-var(theme, 'noteList-backgroundColor'), 20%)
346+
color get-theme-var(theme, 'text-color')
347+
&:active
343348
transition 0.15s
344-
background-color alpha($ui-monokai-noteList-backgroundColor, 20%)
345-
color $ui-monokai-text-color
346-
&:active
347-
transition 0.15s
348-
background-color $ui-monokai-noteList-backgroundColor
349-
color $ui-monokai-text-color
350-
.item-title
351-
.item-title-icon
352-
.item-bottom-time
353-
transition 0.15s
354-
color $ui-monokai-text-color
355-
.item-bottom-tagList-item
356-
transition 0.15s
357-
background-color alpha($ui-monokai-noteList-backgroundColor, 10%)
358-
color $ui-monokai-text-color
359-
360-
.item-wrapper
361-
border-color alpha($ui-monokai-button-backgroundColor, 60%)
349+
background-color get-theme-var(theme, 'noteList-backgroundColor')
350+
color get-theme-var(theme, 'text-color')
351+
.item-title
352+
.item-title-icon
353+
.item-bottom-time
354+
transition 0.15s
355+
color get-theme-var(theme, 'text-color')
356+
.item-bottom-tagList-item
357+
transition 0.15s
358+
background-color alpha(get-theme-var(theme, 'noteList-backgroundColor'), 10%)
359+
color get-theme-var(theme, 'text-color')
362360

363-
.item--active
364-
border-color $ui-monokai-borderColor
365-
background-color $ui-monokai-button-backgroundColor
366361
.item-wrapper
367-
border-color transparent
368-
.item-title
369-
.item-title-icon
370-
.item-bottom-time
371-
color $ui-monokai-active-color
372-
.item-bottom-tagList-item
373-
background-color alpha(white, 10%)
374-
color $ui-monokai-text-color
375-
&:hover
376-
// background-color alpha($ui-monokai-button--active-backgroundColor, 60%)
377-
color #f92672
378-
.item-bottom-tagList-item
379-
background-color alpha(#fff, 20%)
380-
381-
.item-title
382-
color $ui-inactive-text-color
383-
384-
.item-title-icon
385-
color $ui-inactive-text-color
386-
387-
.item-title-empty
388-
color $ui-inactive-text-color
389-
390-
.item-bottom-tagList-item
391-
background-color alpha($ui-dark-button--active-backgroundColor, 40%)
392-
color $ui-inactive-text-color
393-
394-
.item-bottom-tagList-empty
395-
color $ui-inactive-text-color
396-
vertical-align middle
362+
border-color alpha(get-theme-var(theme, 'button-backgroundColor'), 60%)
397363

398-
body[data-theme="dracula"]
399-
.root
400-
border-color $ui-dracula-borderColor
401-
background-color $ui-dracula-noteList-backgroundColor
402-
403-
.item
404-
border-color $ui-dracula-borderColor
405-
background-color $ui-dracula-noteList-backgroundColor
406-
&:hover
407-
transition 0.15s
408-
// background-color alpha($ui-dracula-noteList-backgroundColor, 20%)
409-
color $ui-dracula-text-color
364+
.item--active
365+
border-color get-theme-var(theme, 'borderColor')
366+
background-color get-theme-var(theme, 'button-backgroundColor')
367+
.item-wrapper
368+
border-color transparent
410369
.item-title
411370
.item-title-icon
412371
.item-bottom-time
413-
transition 0.15s
414-
color $ui-dracula-text-color
372+
color get-theme-var(theme, 'active-color')
415373
.item-bottom-tagList-item
416-
transition 0.15s
417-
background-color alpha($ui-dracula-noteList-backgroundColor, 20%)
418-
color $ui-dracula-text-color
419-
&:active
420-
transition 0.15s
421-
background-color $ui-dracula-noteList-backgroundColor
422-
color $ui-dracula-text-color
423-
.item-title
424-
.item-title-icon
425-
.item-bottom-time
426-
transition 0.15s
427-
color $ui-dracula-text-color
428-
.item-bottom-tagList-item
429-
transition 0.15s
430-
background-color alpha($ui-dracula-noteList-backgroundColor, 10%)
431-
color $ui-dracula-text-color
374+
background-color alpha(get-theme-var(theme, 'tagList-backgroundColor'), 10%)
375+
color get-theme-var(theme, 'text-color')
376+
&:hover
377+
// background-color alpha(get-theme-var(theme, 'button--active-backgroundColor'), 60%)
378+
color get-theme-var(theme, 'button--hover-color')
379+
.item-bottom-tagList-item
380+
background-color alpha(get-theme-var(theme, 'tagList-backgroundColor'), 20%)
432381

433-
.item-wrapper
434-
border-color alpha($ui-dracula-button-backgroundColor, 60%)
435-
436-
.item--active
437-
border-color $ui-dracula-borderColor
438-
background-color $ui-dracula-button-backgroundColor
439-
.item-wrapper
440-
border-color transparent
441382
.item-title
383+
color $ui-inactive-text-color
384+
442385
.item-title-icon
443-
.item-bottom-time
444-
color $ui-dracula-active-color
445-
.item-bottom-tagList-item
446-
background-color alpha(#f8f8f2, 10%)
447-
color $ui-dracula-text-color
448-
&:hover
449-
// background-color alpha($ui-dracula-button--active-backgroundColor, 60%)
450-
color #ff79c6
451-
.item-bottom-tagList-item
452-
background-color alpha(#f8f8f2, 20%)
386+
color $ui-inactive-text-color
453387

454-
.item-title
455-
color $ui-inactive-text-color
388+
.item-title-empty
389+
color $ui-inactive-text-color
456390

457-
.item-title-icon
458-
color $ui-inactive-text-color
391+
.item-bottom-tagList-item
392+
background-color alpha($ui-dark-button--active-backgroundColor, 40%)
393+
color $ui-inactive-text-color
459394

460-
.item-title-empty
461-
color $ui-inactive-text-color
395+
.item-bottom-tagList-empty
396+
color $ui-inactive-text-color
397+
vertical-align middle
462398

463-
.item-bottom-tagList-item
464-
background-color alpha($ui-dark-button--active-backgroundColor, 40%)
465-
color $ui-inactive-text-color
399+
for theme in 'dracula'
400+
apply-theme(theme)
466401

467-
.item-bottom-tagList-empty
468-
color $ui-inactive-text-color
469-
vertical-align middle
402+
for theme in $themes
403+
apply-theme(theme)

0 commit comments

Comments
 (0)