voces/w3ts-jsx

Add base frame types

Opened this issue · 0 comments

voces commented

We should expose the base frame types as global components (similar to frame). This will simplify:

const Button = ({
	onClick,
	texFile,
	x,
	y,
}: {
	onClick?: () => void;
	texFile: string;
	x: number;
	y: number;
}) => (
	<frame
		typeName="BUTTON"
		inherits="ScoreScreenTabButtonTemplate"
		absPosition={[{ point: FRAMEPOINT_CENTER, x, y }]}
		size={{ width: 0.05, height: 0.05 }}
		onClick={onClick}
	>
		<frame
			typeName="BACKDROP"
			position={["parent"]}
			texture={{
				texFile,
			}}
		/>
	</frame>
);

to just:

const Button = ({
	onClick,
	texFile,
	x,
	y,
}: {
	onClick?: () => void;
	texFile: string;
	x: number;
	y: number;
}): React.Node => (
	<button
		inherits="ScoreScreenTabButtonTemplate"
		absPosition={[{ point: FRAMEPOINT_CENTER, x, y }]}
		size={{ width: 0.05, height: 0.05 }}
		onClick={onClick}
	>
		<backdrop
			position={["parent"]}
			texture={{
				texFile,
			}}
		/>
	</button>
);