houdini/app/javascript/legacy/components/progress-bar.js
2020-04-23 14:09:14 -05:00

23 lines
681 B
JavaScript

// License: LGPL-3.0-or-later
const h = require('snabbdom/h')
const R = require('ramda')
const flyd = require('flyd')
// A progress bar component
// Only a view function
// Simply pass in a state object, which should have:
// - hidden: Boolean (whether to display the bar)
// - percentage: Integer (percentage complete for the bar)
// - status: String (status message to display)
function view(state) {
if(state.hidden) return ''
return h('div.u-centered', [
h('div.progressBar.u-marginY--10', [
h('div.progressBar-fill--striped', {style: {width: state.percentage + '%'}})
])
, h('p.status.u-marginTop--10', [ state.status ])
])
}
module.exports = view