This repository has been archived by the owner on Oct 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcowbell-home.html
157 lines (143 loc) · 5.84 KB
/
cowbell-home.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<link rel="import" href="bower_components/polymer/polymer.html" />
<link rel="import" href="bower_components/app-layout/app-drawer-layout/app-drawer-layout.html">
<link rel="import" href="bower_components/app-layout/app-drawer/app-drawer.html">
<link rel="import" href="bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="bower_components/iron-icons/iron-icons.html">
<link rel="import" href="bower_components/iron-media-query/iron-media-query.html">
<link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="bower_components/paper-item/paper-item.html">
<link rel="import" href="bower_components/paper-menu/paper-menu.html">
<link rel="import" href="bower_components/paper-tabs/paper-tabs.html">
<dom-module id="cowbell-home">
<template>
<style>
body {
margin: 0;
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
background: #f1f1f1;
}
app-toolbar {
background-color: #4285f4;
color: #fff;
}
paper-icon-button + [main-title] {
margin-left: 24px;
}
app-header {
@apply(--layout-fixed-top);
color: #fff;
--app-header-background-rear-layer: {
background-color: #ef6c00;
};
-webkit-app-region: drag;
}
input[type="submit"],
input[type="reset"],
input[type="button"],
input[type="text"],
button,
paper-icon-button,
textarea {
-webkit-app-region: no-drag;
}
sample-content {
padding-top: 64px;
}
.main-header {
box-shadow: 0px 5px 6px -3px rgba(0, 0, 0, 0.4);
}
paper-tabs {
--paper-tabs-selection-bar-color: black;
height: 100%;
max-width: 640px;
}
paper-tab {
--paper-tab-ink: #aaa;
text-transform: uppercase;
}
[hidden] {
display: none !important;
}
</style>
<app-drawer-layout force-narrow>
<app-drawer id="drawer">
<app-toolbar></app-toolbar>
<!-- Nav on mobile: side nav menu -->
<paper-menu selected="{{selected}}" attr-for-selected="name">
<template is="dom-repeat" items="{{items}}">
<paper-item name="{{item}}">{{item}}</paper-item>
</template>
</paper-menu>
</app-drawer>
<app-header-layout>
<app-header class="main-header">
<app-toolbar>
<paper-icon-button class="menu-button" icon="menu" drawer-toggle hidden$="{{wideLayout}}"></paper-icon-button>
<h3 main-title>Cowbell Bot</h3>
<paper-icon-button icon="remove" id="title-min" on-click="windowMin"></paper-icon-button>
<paper-icon-button icon="check-box-outline-blank" id="title-max" on-click="windowMax"></paper-icon-button>
<paper-icon-button icon="close" id="title-close" on-click="windowClose"></paper-icon-button>
</app-toolbar>
<app-toolbar class="tabs-bar" hidden$="{{!wideLayout}}">
<!-- Nav on desktop: tabs -->
<paper-tabs selected="{{selected}}" attr-for-selected="name">
<template is="dom-repeat" items="{{items}}">
<paper-tab name="{{item}}">{{item}}</paper-tab>
</template>
</paper-tabs>
</app-toolbar>
</app-header>
</app-header-layout>
</app-drawer-layout>
<iron-media-query query="min-width: 600px" query-matches="{{wideLayout}}"></iron-media-query>
</template>
<script>
const {BrowserWindow} = require('electron').remote
Polymer({
is: 'cowbell-home',
properties: {
selected: {
type: String,
value: 'Dashboard'
},
wideLayout: {
type: Boolean,
value: false,
observer: 'onLayoutChange',
},
items: {
type: Array,
value: function () {
return ['Dashboard'];
}
}
},
onLayoutChange: function (wide) {
var drawer = this.$.drawer;
if (wide && drawer.opened) {
drawer.opened = false;
}
},
windowMin: function () {
var window = BrowserWindow.getFocusedWindow();
window.minimize();
},
windowMax: function () {
var window = BrowserWindow.getFocusedWindow();
if (window.isMaximized()) {
window.unmaximize();
} else {
window.maximize();
}
},
windowClose: function () {
var window = BrowserWindow.getFocusedWindow();
window.close();
}
});
</script>
</dom-module>