Remove unused javascript
This commit is contained in:
parent
e4818800c5
commit
0b065f226d
2 changed files with 0 additions and 66 deletions
|
@ -1,24 +0,0 @@
|
||||||
// License: LGPL-3.0-or-later
|
|
||||||
const R = require('ramda')
|
|
||||||
const h = require('flimflam/h')
|
|
||||||
const flyd = require('flimflam/flyd')
|
|
||||||
const wizard = require('flimflam/ui/wizard')
|
|
||||||
const carousel = require('./carousel')
|
|
||||||
|
|
||||||
// the api for this components is the same as the regular ff wizard.
|
|
||||||
// it wraps the wizard content in a carousel component which adds a horizontally
|
|
||||||
// scrolling animation whenever the wizard index changes.
|
|
||||||
// it also makes the heights of each wizard step the same.
|
|
||||||
const content = (state, content) => {
|
|
||||||
const count = content.length
|
|
||||||
const index = state.isCompleted$() ? (state.currentStep$() + 1) : state.currentStep$()
|
|
||||||
return carousel({count, index, content})
|
|
||||||
}
|
|
||||||
|
|
||||||
const labels = (state, steps) => {
|
|
||||||
const truncatedSteps = R.map(x => h('span.inline-block.truncate', x), steps)
|
|
||||||
return wizard.labels(state, truncatedSteps)
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {init: wizard.init, labels, content}
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
// License: LGPL-3.0-or-later
|
|
||||||
const R = require('ramda')
|
|
||||||
const h = require('flimflam/h')
|
|
||||||
|
|
||||||
const setWidth = (elm, number) =>
|
|
||||||
elm.style.width = number * elm.parentElement.offsetWidth + 'px'
|
|
||||||
|
|
||||||
const setItemsDimensions = (items, percent) => {
|
|
||||||
const heights = R.map(x => x.offsetHeight, items)
|
|
||||||
const tallest = R.reduce((a, b) => a >= b ? a : b , 0, heights)
|
|
||||||
R.map(x => {
|
|
||||||
x.style.width = percent + '%'
|
|
||||||
x.style.height = tallest + 'px'
|
|
||||||
}, items)
|
|
||||||
}
|
|
||||||
|
|
||||||
const init = (count, percent) => vnode => {
|
|
||||||
const elm = vnode.elm
|
|
||||||
const items = elm.childNodes
|
|
||||||
setItemsDimensions(items, percent)
|
|
||||||
setWidth(elm, count)
|
|
||||||
window.addEventListener('resize', () => {
|
|
||||||
setItemsDimensions(items, percent)
|
|
||||||
setWidth(elm, count)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = obj => {
|
|
||||||
const percent = 100 / obj.count
|
|
||||||
return h('div', [
|
|
||||||
h('div.overflow-hidden', [
|
|
||||||
h('div.transition-slow.clearfix'
|
|
||||||
, {
|
|
||||||
hook: {insert: init(obj.count, percent)}
|
|
||||||
, style: {transform: `translateZ(0) translateX(-${percent * obj.index}%)`}
|
|
||||||
}
|
|
||||||
, R.map(x => h('div.left.p-2.table', [h('div.middle-cell', [x])]), obj.content)
|
|
||||||
)
|
|
||||||
])
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue