creo el compontent text

pull/11/head
Borja Robert 2 years ago
parent 0cdd63439f
commit 362c697f79

@ -0,0 +1,23 @@
import { getMonthName } from '$lib/monthName';
/**
* @param {string} date - Fecha del evento
* @returns {string} - Fecha en dia (número) mes (letras)
*/
export const convertDate = (date) => {
if (date == undefined) {
return '';
}
/** @type {string} */ const monthNumber = date.split('-')[1];
/** @type {string} */ let day = date.split('-')[2].split('T')[0];
/** @type {number} */ const dayNumber = Number(day);
/** @type {string} */ const month = getMonthName(monthNumber);
/** Removes 0 on single digit days */
if (dayNumber < 10) {
day = day.charAt(1);
}
/** @type {string} */ const res = `${day} ${month}`;
return res;
};

@ -12,6 +12,7 @@
import Date from '$lib/templates/Date.svelte'; import Date from '$lib/templates/Date.svelte';
import Weekday from '$lib/templates/Weekday.svelte'; import Weekday from '$lib/templates/Weekday.svelte';
import Address from '$lib/templates/Address.svelte'; import Address from '$lib/templates/Address.svelte';
import Text from '$lib/templates/Text.svelte';
</script> </script>
<div class="preview"> <div class="preview">
@ -74,6 +75,9 @@
</div> </div>
{/if} {/if}
</div> </div>
<div class="text">
<Text {templateIndex} />
</div>
</div> </div>
<style> <style>

@ -0,0 +1,37 @@
<script>
import { templates } from '$lib/templates/templates';
import {
heading,
title,
subtitle,
content,
date,
time,
weekday,
address
} from '$lib/stores/store';
import { convertDate } from '$lib/convertDate';
/** @type number */ export let templateIndex;
const template = templates[templateIndex];
/** @type {string} */ let textDate;
/** @type {string} */ let textHeading;
/** @type {string} */ let textWeekday;
$: if ($date !== '') {
textDate = convertDate($date);
}
$: if ($heading !== '') {
textHeading = $heading;
}
$: if ($weekday !== '') {
textWeekday = $weekday;
}
</script>
<div class="text" contenteditable="true">
<p>El {textWeekday}, {textDate}, te invitamos a participar en el {textHeading}</p>
</div>

@ -17,13 +17,13 @@ export const azul = {
fontWeight: 700 fontWeight: 700
}, },
title: { title: {
top: 445, top: 440,
height: 7.5, height: 7.5,
left: 1, left: 1,
right: 1, right: 1,
fontSize: 3, fontSize: 3,
color: "firebrick", color: "firebrick",
fontFamily: "sans-serif", fontFamily: "'Arial', sans-serif",
lineHeight: 2.4, lineHeight: 2.4,
textAlign: "right", textAlign: "right",
fontWeight: 700 fontWeight: 700
@ -33,7 +33,7 @@ export const azul = {
top: 575, top: 575,
height: 1.4, height: 1.4,
left: 1, left: 1,
right: 2, right: 1,
fontSize: 1.6, fontSize: 1.6,
color: "white", color: "white",
fontFamily: "Gill Sans, sans-serif", fontFamily: "Gill Sans, sans-serif",

Loading…
Cancel
Save