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

Initial implementation of "Settings" modal. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
66 changes: 65 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,75 @@ input[type=text] {
#actions { display: flex; }
/* #actions button:first-child { margin-right: 0.5rem; } */

#container {
.container {
height: 100vh;
width: 100vw;
}

.modal {
position: fixed;
background: hsla(0, 0%, 100%, 0.95);
left: 50%;
min-height: 50%;
min-width: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 999;
}

.modal--body {
display: flex;
flex-wrap: wrap;
justify-content: center;
}

.modal--footer {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 2rem 0rem 2rem 0rem;
}

.modal--button {
border-radius: 0rem;
height: 2.5rem;
width: 5.5rem;
}

.modal--button-confirm {
background-color: #3ecf72;
}

.modal--button-cancel {
background-color: #999999;
}

.container--settings {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}



.input {
margin: 1rem;
}

input {
padding: 0.5rem;
border: 1px solid #aaa;
border-radius: 0.12rem;
box-shadow: none;
outline: none;
}

.label--input {
margin-top: 0px;
margin-bottom: 0.25rem;
}

#interface {
box-sizing: border-box;
display: flex;
Expand Down
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ app.use(function (state, emitter) {
state.broadcast.active = false
state.broadcast.key = null

state.ui = {}
state.ui.settings = false

emitter.on('broadcast:start', function (key) {
state.broadcast.active = true
state.broadcast.key = key
Expand All @@ -19,6 +22,11 @@ app.use(function (state, emitter) {

emitter.emit('render')
})

emitter.on('ui:settings', function () {
state.ui.settings = !state.ui.settings
emitter.emit('render')
})
})

app.route('/', require('./templates/home'))
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "https://github.com/louiscenter/hypercast"
},
"devDependencies": {
"electron": "1.7.10"
"electron": "1.7.11"
},
"dependencies": {
"buffer-to-arraybuffer": "0.0.5",
Expand Down
17 changes: 16 additions & 1 deletion templates/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var onload = require('on-load')
var broadcast = require('../lib/broadcast')
var gum = require('../lib/gum')

var settings = require('./settings.js')

var button = require('./button')
var input = require('./input')
var label = require('./label')
Expand All @@ -12,9 +14,11 @@ module.exports = home

function home (state, emit) {
var el = html`
<div id="container">
<div class="container">
<video id="preview" autoplay muted></video>

${state.ui.settings ? settings(): null}

<div id="interface">
<div id="nav">
${label({
Expand All @@ -28,6 +32,13 @@ function home (state, emit) {
text: `${!state.broadcast.active ? 'Start' : 'Stop'} Broadcast`
})}
</div>
<div id="">
${button({
color: 'grey',
onclick: viewSettings,
text: `Settings`
})}
</div>
</div>

<div id="nav">
Expand All @@ -43,6 +54,10 @@ function home (state, emit) {
</div>
`

function viewSettings () {
emit('ui:settings')
}

onload(el, function () {
gum(function (err, stream) {
var elPreview = document.getElementById('preview')
Expand Down
27 changes: 27 additions & 0 deletions templates/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var html = require('choo/html')

module.exports = function () {
return html `
<div class="modal container--settings">
<div style="display: flex;">
<h4>Settings</h4>
</div>
<div class="modal--body">
<div class="input">
<h5 class="label--input">Input Audio</h5>
<input class="input-audio" />
</div>
<div class="input">
<h5 class="label--input">Output Audio</h5>
<input class="input-audio" />
</div>
</div>
<div class="modal--footer">
<div class="container--button">
<button class="modal--button modal--button-confirm">Save</button>
<button class="modal--button cancel">Cancel</button>
</div>
</div>
</div>
`
}