git ssb

2+

mixmix / ticktack



Commit 65bba059de67096d23a74b9e419174aa97fa4977

Merge pull request #96 from ticktackim/frameless

minimal frameless setup
mix irving authored on 2/11/2018, 1:47:14 AM
GitHub committed on 2/11/2018, 1:47:14 AM
Parent: 9a9177d891de3415bfefa1a639dd2ca57dcf7cce
Parent: ab6039706a099a9c4a6c9e4ff04749ba3ed998d6

Files changed

app/html/header.jschanged
app/html/header.mcsschanged
index.jschanged
app/html/header.jsView
@@ -1,8 +1,9 @@
11 const nest = require('depnest')
22 const { h, computed, when } = require('mutant')
33 const get = require('lodash/get')
44 const path = require('path')
5+const remote = require('electron').remote
56
67 exports.gives = nest('app.html.header')
78
89 exports.needs = nest('keys.sync.id', 'first')
@@ -23,23 +24,45 @@
2324 })
2425
2526 if (loc().page === 'splash') return
2627
28+ const window = remote.getCurrentWindow()
29+ const minimize = () => window.minimize()
30+ const maximize = () => {
31+ if (!window.isMaximized()) window.maximize()
32+ else window.unmaximize()
33+ }
34+ const close = () => window.close()
35+
2736 const isSettings = computed(loc, loc => SETTINGS_PAGES.includes(loc.page))
2837 const isAddressBook = computed(loc, loc => loc.page === 'addressBook')
2938 const isFeed = computed([isAddressBook, isSettings], (p, s) => !p && !s)
3039
3140 return h('Header', [
41+ h('div.window-controls', [
42+ h('img.min', {
43+ src: assetPath('minimize.png'),
44+ 'ev-click': minimize
45+ }),
46+ h('img.max', {
47+ src: assetPath('maximize.png'),
48+ 'ev-click': maximize
49+ }),
50+ h('img.close', {
51+ src: assetPath('close.png'),
52+ 'ev-click': close
53+ })
54+ ]),
3255 h('nav', [
33- h('img.feed', {
56+ h('img.feed', {
3457 src: when(isFeed, assetPath('feed_on.png'), assetPath('feed.png')),
3558 'ev-click': () => push({page: 'blogIndex'}),
3659 }),
37- h('img.addressBook', {
60+ h('img.addressBook', {
3861 src: when(isAddressBook, assetPath('address_bk_on.png'), assetPath('address_bk.png')),
3962 'ev-click': () => push({page: 'addressBook'})
4063 }),
41- h('img.settings', {
64+ h('img.settings', {
4265 src: when(isSettings, assetPath('settings_on.png'), assetPath('settings.png')),
4366 'ev-click': () => push({page: 'settings'})
4467 }),
4568 ]),
@@ -49,5 +72,4 @@
4972
5073 function assetPath (name) {
5174 return path.join(__dirname, '../../assets', name)
5275 }
53-
app/html/header.mcssView
@@ -1,8 +1,23 @@
11 Header {
2+ div.window-controls {
3+ position: fixed
4+ right: 0
5+ z-index: 100
6+
7+ display: flex
8+
9+ img {
10+ padding: .5rem
11+ cursor: pointer
12+ :hover {
13+ filter: drop-shadow(rgba(255, 255, 255, .5) 0 0 2px)
14+ }
15+ }
16+ }
17+
218 nav {
319 $colorPrimary
4- $navFA
520 padding: 1rem 0
621
722 width: 100%
823 height: 1.5rem
@@ -29,5 +44,4 @@
2944 text-decoration: underline
3045 }
3146 }
3247 }
33-
index.jsView
@@ -85,8 +85,10 @@
8585 width: windowState.width,
8686 height: windowState.height,
8787 autoHideMenuBar: true,
8888 title: 'Ticktack',
89+ frame: false,
90+ titleBarStyle: 'hidden',
8991 show: true,
9092 backgroundColor: '#EEE',
9193 icon: './assets/icon.png'
9294 })
@@ -132,5 +134,4 @@
132134
133135 window.loadURL('file://' + Path.join(__dirname, 'assets', 'base.html'))
134136 return window
135137 }
136-

Built with git-ssb-web