import R from 'ramda';
import React from 'react';
import seeds, { Seed } from 'react-seeds';
import { Spectacle, Deck, Slide, Text } from 'spectacle';

import * as Vanilla from './Vanilla';
import { renderTreeUsing } from './render';

var text = function text(tag, mentions, _text) {
	return React.createElement(Text, { children: _text });
};

var elementRendererForTags = R.cond([
// [ R.has('field'), R.curry(Vanilla.field) ],
// [ R.has('button'), R.curry(Vanilla.button) ],
// [ R.has('cta'), R.curry(Vanilla.cta) ],
// [ R.has('image'), R.curry(Vanilla.image) ],
// [ R.has('video'), R.curry(Vanilla.video) ],
[R.has('text'), R.curry(text)],
// [ R.has('swatch'), R.curry(Vanilla.swatch) ],
// [ R.has('nav'), R.curry(Vanilla.nav) ],
// [ R.has('columns'), R.curry(Vanilla.columns) ],
// [ R.has('list'), R.curry(Vanilla.list) ],
[R.T, R.curry(text)]]);

var Section = React.createClass({
	displayName: 'Section',
	getDefaultProps: function getDefaultProps() {
		return {
			transition: ['zoom']
		};
	},
	render: function render() {
		return React.createElement(Slide, this.props);
	}
});

var Master = function Master(_ref) {
	var children = _ref.children;
	return React.createElement(
		Spectacle,
		null,
		React.createElement(Deck, { children: children, transition: ['zoom'] })
	);
};

export var Preview = R.pipe(renderTreeUsing({
	elementRendererForTags: elementRendererForTags,
	Section: Slide,
	Master: Master
}));

export var title = 'Slides';

export function head() {
	return React.createElement('head', null);
}