"use strict";

const React = require("react");

const useTheme = require("../../util/themeable");
const defaultStyle = require("./style.css");
const generateGridItemStyle = require("../../util/generate-grid-item-style");

module.exports = function Text({ x, y, align, children }) {
	let { withTheme } = useTheme({ control: "text", defaultStyle });

	let alignClass = (align != null)
		? `align-${align}`
		: undefined;

	return (
		<div className={withTheme("uilibComponent", "text", alignClass)} style={generateGridItemStyle({ x, y })}>
			{children}
		</div>
	);
};
