@@ -111,47 +108,14 @@
aspect-ratio: 1/1.4142;
min-height: 842px;
align-self: center;
- /* background-color: rebeccapurple; */
width: auto;
- background-image: url('/imagen01.png');
+ /* background-image: url('/imagen01.png'); */
background-size: contain;
position: relative;
padding: 1rem;
- /* border-radius: 0.5rem; */
}
- .subtitle {
- position: absolute;
- display: flex;
- top: 410px;
- left: 1rem;
- right: 2rem;
- font-size: 1.2rem;
- color: #787;
- text-transform: uppercase;
- height: 3rem;
- overflow: hidden;
- text-align: center;
- align-items: start;
- justify-content: center;
- }
-
- .content {
- position: absolute;
- display: flex;
- flex-direction: column;
- justify-content: center;
- top: 480px;
- left: 1.5rem;
- right: 17rem;
- height: 8.5rem;
- font-size: 0.8rem;
- color: #222;
- line-height: 1rem;
- overflow: hidden;
- }
-
- .weekday {
+ /* .weekday {
position: absolute;
text-transform: uppercase;
top: 600px;
@@ -163,9 +127,9 @@
font-weight: 700;
overflow: hidden;
text-align: center;
- }
+ } */
- .date {
+ /* .date {
position: absolute;
text-transform: uppercase;
top: 625px;
@@ -177,8 +141,8 @@
max-height: 2rem;
overflow: hidden;
text-align: center;
- }
-
+ } */
+ /*
.time {
position: absolute;
top: 645px;
@@ -190,9 +154,9 @@
overflow: hidden;
text-align: center;
font-weight: 700;
- }
+ } */
- .address {
+ /* .address {
position: absolute;
display: grid;
top: 620px;
@@ -209,7 +173,7 @@
white-space: pre-wrap;
align-items: center;
justify-content: center;
- }
+ } */
.imagetitle {
position: absolute;
@@ -292,5 +256,4 @@
grid-column: 2/3;
display: flex;
}
- /* @import url(`'${template}.css'`); */
diff --git a/src/lib/templates/Address.svelte b/src/lib/templates/Address.svelte
new file mode 100644
index 0000000..6831217
--- /dev/null
+++ b/src/lib/templates/Address.svelte
@@ -0,0 +1,37 @@
+
+
+{#if templates[templateIndex] && $address}
+
+ {$address}
+
+{/if}
+
+
diff --git a/src/lib/templates/Content.svelte b/src/lib/templates/Content.svelte
new file mode 100644
index 0000000..636f0ae
--- /dev/null
+++ b/src/lib/templates/Content.svelte
@@ -0,0 +1,33 @@
+
+
+{#if templates[templateIndex] && $content}
+
+ {@html $content}
+
+{/if}
+
+
diff --git a/src/lib/templates/Date.svelte b/src/lib/templates/Date.svelte
new file mode 100644
index 0000000..8de4508
--- /dev/null
+++ b/src/lib/templates/Date.svelte
@@ -0,0 +1,89 @@
+
+
+{#if templates[templateIndex] && newdate.date}
+
+ {newdate.date}
+
+{/if}
+{#if templates[templateIndex] && newdate.time}
+
+ {newdate.time}
+
+{/if}
+
+
diff --git a/src/lib/templates/Subtitle.svelte b/src/lib/templates/Subtitle.svelte
new file mode 100644
index 0000000..14fccea
--- /dev/null
+++ b/src/lib/templates/Subtitle.svelte
@@ -0,0 +1,35 @@
+
+
+{#if templates[templateIndex] && $subtitle}
+
+ {$subtitle}
+
+{/if}
+
+
diff --git a/src/lib/templates/Weekday.svelte b/src/lib/templates/Weekday.svelte
new file mode 100644
index 0000000..2bd8227
--- /dev/null
+++ b/src/lib/templates/Weekday.svelte
@@ -0,0 +1,33 @@
+
+
+{#if templates[templateIndex] && $weekday}
+
+ {$weekday}
+
+{/if}
+
+
diff --git a/src/lib/templates/templates.js b/src/lib/templates/templates.js
index 338dac5..231de45 100644
--- a/src/lib/templates/templates.js
+++ b/src/lib/templates/templates.js
@@ -15,10 +15,12 @@ import { verde } from '$lib/templates/verde';
/**
* @typedef {{
* name: string;
+ * image: string;
* heading: Element;
* title: Element;
* subtitle: Element;
- * datetime: Element;
+ * date: Element;
+ * time: Element;
* weekday: Element;
* content: Element;
* address: Element;
diff --git a/src/lib/templates/verde.js b/src/lib/templates/verde.js
index 234c84f..164f964 100644
--- a/src/lib/templates/verde.js
+++ b/src/lib/templates/verde.js
@@ -1,5 +1,6 @@
-/** @typedef {{
+/**
+* @typedef {{
* top: number;
* height: number;
* right: number;
@@ -14,10 +15,12 @@
/**
* @typedef {{
* name: string;
+* image: string;
* heading: Element;
* title: Element;
* subtitle: Element;
-* datetime: Element;
+* date: Element;
+* time: Element;
* weekday: Element;
* content: Element;
* address: Element;
@@ -27,6 +30,7 @@
/** @type {Template} */
export const verde = {
name: "verde",
+ image: "imagen01.png",
heading: {
top: 300,
height: 1.2,
@@ -49,53 +53,63 @@ export const verde = {
},
subtitle: {
- top: 100,
- height: 6,
- left: 2,
+ top: 420,
+ height: 3,
+ left: 1,
right: 2,
- fontSize: 1.8,
- color: "firebrick",
+ fontSize: 1.2,
+ color: "#787",
fontFamily: "Gill Sans, sans-serif",
- lineHeight: 2
+ lineHeight: 1.5
},
content: {
- top: 100,
- height: 6,
- left: 2,
- right: 2,
- fontSize: 1.8,
- color: "firebrick",
- fontFamily: "Gill Sans, sans-serif",
- lineHeight: 1
+ top: 480,
+ height: 8.5,
+ left: 1.5,
+ right: 17,
+ fontSize: 0.8,
+ color: "#222",
+ fontFamily: "sans-serif",
+ lineHeight: 1.1
},
- datetime: {
- top: 400,
+ date: {
+ top: 625,
height: 4,
- left: 2,
- right: 2,
- fontSize: 1,
- color: "firebrick",
+ left: 18.5,
+ right: 4,
+ fontSize: 1.1,
+ color: "#fff",
+ fontFamily: "sans-serif",
+ lineHeight: 1
+ },
+ time: {
+ top: 645,
+ height: 2,
+ left: 18.5,
+ right: 5,
+ fontSize: 1.8,
+ color: "#fff",
fontFamily: "sans-serif",
lineHeight: 1
},
weekday: {
- top: 500,
+ top: 600,
height: 1.5,
- left: 2,
- right: 2,
- fontSize: 1,
- color: "#333",
+ left: 18.5,
+ right: 5,
+ fontSize: 1.3,
+ color: "#fff",
fontFamily: "sans-serif",
- lineHeight: 1
+ lineHeight: 1.8
},
address: {
- top: 500,
- height: 1.5,
+ top: 625,
+ height: 4.5,
left: 2,
- right: 2,
+ right: 20,
fontSize: 1,
- color: "#333",
+ color: "firebrick",
fontFamily: "sans-serif",
- lineHeight: 1
+ lineHeight: 1.5
},
}
\ No newline at end of file
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 8954221..c5f6527 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -1,8 +1,4 @@
@@ -14,26 +10,18 @@
diff --git a/src/routes/[slug]/+error.svelte b/src/routes/[slug]/+error.svelte
new file mode 100644
index 0000000..d19e1de
--- /dev/null
+++ b/src/routes/[slug]/+error.svelte
@@ -0,0 +1,14 @@
+
+
+{#if $page.error}
+
{$page.status}: {$page.error.message}
+{/if}
+
+
diff --git a/src/routes/[slug]/+page.js b/src/routes/[slug]/+page.js
index 1a2d908..54b2ce7 100644
--- a/src/routes/[slug]/+page.js
+++ b/src/routes/[slug]/+page.js
@@ -1,12 +1,21 @@
+import { error } from '@sveltejs/kit';
import { templates } from '$lib/templates/templates';
/** @type {import('./$types').PageLoad} */
export function load(event) {
+
+ /** @type {string} */
const slug = event.params.slug;
- /** @type {number|undefined} */ const templateIndex = templates.map((e) => e.name).indexOf(slug);
+
+ /** @type {number} */ const templateIndex = templates.map((e) => e.name).indexOf(slug);
+ /** @type {string} */ const templateImage = templates[templateIndex].image;
if (templateIndex !== -1) {
return {
- slug
+ slug,
+ templateIndex,
+ templateImage
}
}
+
+ throw error(404, "Not found");
}
diff --git a/src/routes/[slug]/+page.svelte b/src/routes/[slug]/+page.svelte
index 38f1510..5c127ed 100644
--- a/src/routes/[slug]/+page.svelte
+++ b/src/routes/[slug]/+page.svelte
@@ -1,26 +1,33 @@
- Carteles DMD
-
+ Carteles DMD - Plantilla {data.slug}
+
{#if templateIndex !== undefined}
{/if}