← back to Small Business Builder

src/render/templates/index.js

18 lines

import * as t1 from './template-1.js';
import * as t2 from './template-2.js';
import * as t3 from './template-3.js';
import * as t4 from './template-4.js';
import * as t5 from './template-5.js';

export const TEMPLATES = [t1, t2, t3, t4, t5];

export function renderTemplate(id, business) {
  const t = TEMPLATES[id - 1];
  if (!t) throw new Error(`Unknown template id ${id}`);
  return t.render(business);
}

export function templateMeta() {
  return TEMPLATES.map(t => t.meta);
}