summaryrefslogtreecommitdiff
path: root/frontend/app/views/tile/forms/tile.constructors.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/views/tile/forms/tile.constructors.js')
-rw-r--r--frontend/app/views/tile/forms/tile.constructors.js113
1 files changed, 113 insertions, 0 deletions
diff --git a/frontend/app/views/tile/forms/tile.constructors.js b/frontend/app/views/tile/forms/tile.constructors.js
new file mode 100644
index 0000000..2407274
--- /dev/null
+++ b/frontend/app/views/tile/forms/tile.constructors.js
@@ -0,0 +1,113 @@
+const newImage = (data) => ({
+ settings: {
+ ...newPosition(),
+ is_tiled: false,
+ tile_style: 'tile',
+ url: "",
+ external_link_url: "",
+ cursor: 'hand_up',
+ },
+ type: 'image',
+ target_page_id: 0,
+ ...data,
+})
+
+const newVideo = (data) => ({
+ settings: {
+ ...newPosition(),
+ video_style: 'cover',
+ url: "",
+ external_link_url: "",
+ cursor: 'none',
+ muted: false,
+ loop_style: false,
+ autoadvance: false,
+ loop_section: false,
+ loop_start: 0,
+ loop_end: 0,
+ },
+ type: 'video',
+ target_page_id: 0,
+ ...data,
+})
+
+const newText = (data) => ({
+ settings: {
+ ...newPosition(),
+ content: "",
+ font_family: 'sans-serif',
+ font_size: 16,
+ font_style: 'normal',
+ font_color: '#dddddd',
+ background_color: 'transparent',
+ width: 0,
+ height: 0,
+ units: 'px',
+ external_link_url: "",
+ cursor: 'hand_up',
+ },
+ type: 'text',
+ target_page_id: 0,
+ ...data,
+})
+
+const newGradient = (data) => ({
+ settings: {
+ ...newPosition({ width: 100, height: 100 }),
+ from_color: '#ffffff',
+ from_opacity: 1.0,
+ to_color: '#000000',
+ to_opacity: 1.0,
+ angle: 0,
+ stop: 50,
+ units: '%',
+ external_link_url: "",
+ cursor: 'hand_up',
+ },
+ type: 'gradient',
+ target_page_id: 0,
+ ...data,
+})
+
+const newLink = (data) => ({
+ settings: {
+ ...newPosition({ width: 100, height: 100, }),
+ external_link_url: "",
+ cursor: 'hand_up',
+ units: 'px',
+ },
+ type: 'link',
+ target_page_id: 0,
+ ...data,
+})
+
+const newScript = (data) => ({
+ settings: {
+ ...newPosition({ width: 100, height: 100, }),
+ },
+ type: 'script',
+ ...data,
+})
+
+const newPosition = (data) => ({
+ x: 0, y: 0,
+ width: 0, height: 0,
+ rotation: 0, scale: 1,
+ opacity: 1,
+ units: false,
+ align: "center_center",
+ has_audio: false,
+ audio_on_click_id: 0,
+ audio_on_hover_id: 0,
+ navigate_when_audio_finishes: false,
+ ...data,
+})
+
+export const TILE_CONSTRUCTORS = {
+ image: newImage,
+ video: newVideo,
+ text: newText,
+ link: newLink,
+ gradient: newGradient,
+ script: newScript,
+}