From 00708174a9ddff521561d7a3cf712735fbec9120 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 14 Apr 2024 21:39:22 +0200 Subject: [PATCH] add default value --- src/page/HomePage.vue | 111 +++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 55 deletions(-) diff --git a/src/page/HomePage.vue b/src/page/HomePage.vue index 70926e5..59ddc9a 100644 --- a/src/page/HomePage.vue +++ b/src/page/HomePage.vue @@ -1,39 +1,17 @@ @@ -379,31 +364,43 @@ export default { data() { return { tool: localStorage.getItem('tool') ?? 'heading', - author: localStorage.getItem('author'), - authorPadding: localStorage.getItem('authorPadding') ?? 0, + author: localStorage.getItem('author') ?? 'Author name', + authorPadding: localStorage.getItem('authorPadding') ?? 10, authorAlign: localStorage.getItem('authorAlign') ?? 'left', - authorTextColor: localStorage.getItem('authorTextColor') ?? 0, - authorMarginBottom: localStorage.getItem('authorMarginBottom') ?? 0, - authorBackgroundColor: localStorage.getItem('authorBackgroundColor') ?? '#000000', - authorBackgroundOpacity: localStorage.getItem('authorBackgroundOpacity') ?? 0, - heading: localStorage.getItem('heading'), - subheading: localStorage.getItem('subheading'), + authorTextColor: localStorage.getItem('authorTextColor') ?? '#fff9e6', + authorMarginBottom: localStorage.getItem('authorMarginBottom') ?? 200, + authorBackgroundColor: localStorage.getItem('authorBackgroundColor') ?? '#fc5705', + authorBackgroundOpacity: localStorage.getItem('authorBackgroundOpacity') ?? 1, + heading: localStorage.getItem('heading') ?? 'Heading', + subheading: localStorage.getItem('subheading') ?? 'Subheading', headingAlign: localStorage.getItem('headingAlign') ?? 'left', font: localStorage.getItem('font') ?? 'Trebuchet MS', avatar: localStorage.getItem('avatar'), logo: localStorage.getItem('logo'), - textColor: localStorage.getItem('textColor') ?? '#333333', + textColor: localStorage.getItem('textColor') ?? '#fc5705', background: localStorage.getItem('background'), - backgroundHover: localStorage.getItem('backgroundHover') ?? '#000000', - backgroundHoverOpacity: localStorage.getItem('backgroundHoverOpacity') ?? 0, + backgroundHover: localStorage.getItem('backgroundHover') ?? '#fff9e6', + backgroundHoverOpacity: localStorage.getItem('backgroundHoverOpacity') ?? 1, headingSize: localStorage.getItem('headingSize') ?? 4, subheadingSize: localStorage.getItem('subheadingSize') ?? 2, - width: localStorage.getItem('width') ?? 1920, - height: localStorage.getItem('height') ?? 1080, - contentPadding: localStorage.getItem('contentPadding') ?? 2.5, + width: localStorage.getItem('width') ?? 1200, + height: localStorage.getItem('height') ?? 600, + contentPadding: localStorage.getItem('contentPadding') ?? 20, allowHtml: localStorage.getItem('allowHtml'), ogMaxWidth: 100, - + tools: { + heading: 'Heading', + author: 'Author', + font: 'Font', + background: 'Background', + sizes: 'Sizes', + }, + sizesRecommendations: { + Mastodon: [1200, 600], + LinkedIn: [1200, 627], + Instagram: [1200, 630], + X: [1200, 675], + }, fonts: [ {label: 'Arial (sans-serif)', value : 'Arial'}, {label: 'Brush Script MT (cursive)', value : 'Brush Script MT'}, @@ -588,6 +585,10 @@ export default { paddingLeft: `${this.contentPadding}px`, } }, + setSizes(width, height) { + this.width = width + this.height = height + }, downloadAsPng() { return this.download(toPng, 'image.png') }, @@ -626,11 +627,6 @@ export default {