Standardize on some nomenclature
This commit is contained in:
parent
7c8a9598ca
commit
a3b4ea2920
@ -6,7 +6,7 @@ import { pouchDocArrayHash, pouchDocHash } from '../utils/conversion.js';
|
||||
import { ThumbnailTemplate } from './thumbnail.js';
|
||||
import { prop, computed } from 'frptools';
|
||||
|
||||
export function AlbumView(vm, doc) {
|
||||
export function AlbumView(vm, params) {
|
||||
const model = prop({}, pouchDocHash);
|
||||
const images = prop([], pouchDocArrayHash);
|
||||
|
||||
@ -57,9 +57,11 @@ export function AlbumView(vm, doc) {
|
||||
subscriptions.forEach(s => s());
|
||||
}
|
||||
|
||||
model(doc);
|
||||
model(params);
|
||||
|
||||
return function() {
|
||||
const album = model();
|
||||
|
||||
return function(vm, album, key, opts) {
|
||||
return el('.album', [
|
||||
el('h2', title),
|
||||
el('button', { onclick: [removeAlbum, album] }, 'X'),
|
||||
|
||||
@ -5,8 +5,8 @@ import { ImageType } from '../../data/image.js';
|
||||
import { FileType } from '../../data/file.js';
|
||||
import { pouchDocHash } from '../../utils/conversion.js';
|
||||
|
||||
export function AttachmentImageView(vm, image) {
|
||||
const model = prop(image, pouchDocHash);
|
||||
export function AttachmentImageView(vm, params) {
|
||||
const model = prop(params, pouchDocHash);
|
||||
const id = computed(pouchDocHash, [model]);
|
||||
const sizes = computed(d => d.sizes, [model]); // always update
|
||||
|
||||
@ -45,7 +45,7 @@ export function AttachmentImageView(vm, image) {
|
||||
URL.revokeObjectURL(blobURL());
|
||||
}
|
||||
|
||||
return function render(vm, doc) {
|
||||
return function render() {
|
||||
return el('img', {
|
||||
src: imageURL,
|
||||
onerror: loadImageFromBlob,
|
||||
|
||||
@ -15,8 +15,8 @@ const CSS_DROPZONE_ACTIVE = {
|
||||
backgroundColor: '#eee'
|
||||
};
|
||||
|
||||
export function Dropzone(vm, model) {
|
||||
const { ondrop, ondragenter, ondragleave, className, activeClassName, children } = model;
|
||||
export function Dropzone(vm, params) {
|
||||
const { ondrop, ondragenter, ondragleave, className, activeClassName, content } = params;
|
||||
|
||||
const baseClassName = className || injectStyle(CSS_DROPZONE);
|
||||
const hoverClassName = `${baseClassName} ${activeClassName || injectStyle(CSS_DROPZONE_ACTIVE)}`;
|
||||
@ -54,7 +54,7 @@ export function Dropzone(vm, model) {
|
||||
}
|
||||
}
|
||||
|
||||
return function render(vm, model) {
|
||||
return function render() {
|
||||
return el(
|
||||
'div',
|
||||
{
|
||||
@ -64,7 +64,7 @@ export function Dropzone(vm, model) {
|
||||
ondragleave: onDragLeave,
|
||||
ondrop: onDrop
|
||||
},
|
||||
children()
|
||||
content()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@ -37,9 +37,9 @@ const ICON_PATHS = {
|
||||
|
||||
// const sizeBasis = 24;
|
||||
|
||||
export function Icon(props) {
|
||||
const { name, size } = props;
|
||||
const otherProps = Object.assign({}, props);
|
||||
export function Icon(params) {
|
||||
const { name, size } = params;
|
||||
const attrs = Object.assign({}, params);
|
||||
const _size = (size || 1) + 1;
|
||||
const [boxBounds, path] = ICON_PATHS[name] || ICON_PATHS.unknown;
|
||||
|
||||
@ -54,7 +54,7 @@ export function Icon(props) {
|
||||
width: `${_size}em`,
|
||||
height: `${_size}em`
|
||||
},
|
||||
otherProps
|
||||
attrs
|
||||
),
|
||||
[sv('svg', { viewBox: `0 0 ${boxBounds}` }, [sv('path', { d: path })])]
|
||||
);
|
||||
|
||||
@ -9,7 +9,7 @@ import { Dropzone } from './components/dropzone.js';
|
||||
import { router, routeChanged } from '../services/router.js';
|
||||
import { injectStyle, styled } from '../services/style.js';
|
||||
|
||||
export function GalleryView(vm, model) {
|
||||
export function GalleryView(vm) {
|
||||
const NAV_OPTIONS = {
|
||||
images: {
|
||||
data: ImageType.find(
|
||||
@ -79,7 +79,7 @@ export function GalleryView(vm, model) {
|
||||
];
|
||||
}
|
||||
|
||||
return function render(vm, params, key, opts) {
|
||||
return function render() {
|
||||
if (!data || !data.ready()) {
|
||||
return el('h1', 'Loading...');
|
||||
}
|
||||
@ -103,7 +103,7 @@ export function GalleryView(vm, model) {
|
||||
type: 'file',
|
||||
multiple: true, // FIXME - these don't carry through to the input tag
|
||||
accept: 'image/jpeg',
|
||||
children: renderDropzone
|
||||
content: renderDropzone
|
||||
},
|
||||
'dz'
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user