From 3f786e64bc21eff9e18637319d7350254183cabb Mon Sep 17 00:00:00 2001 From: mcnaveen Date: Thu, 14 Apr 2022 11:33:39 +0530 Subject: [PATCH] :bug: Fix Click to Load --- README.md | 4 ++-- package.json | 2 +- public/index.html | 2 +- src/App.svelte | 4 ++-- src/components/AllComments.svelte | 14 +++++++------- src/main.js | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 740d79e..285557f 100644 --- a/README.md +++ b/README.md @@ -102,10 +102,10 @@ yarn build - Example: `mysupacomments.com` ```html -
+
``` -- Optionally, You can set the `loadmore` attribute to `true` to disable autoloading of comments, the User has to click Load Comments button. (Default is `false`) +- Optionally, You can set the `clickToLoad` attribute to `true` to disable autoloading of comments, the User has to click Load Comments button. (Default is `false`) Now, If you open your static website or blog, you will see the comments section like below. diff --git a/package.json b/package.json index 7729531..edbefa4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SupaComments", - "version": "0.0.3", + "version": "0.0.4", "private": true, "scripts": { "watch:tailwind": "postcss public/tailwind.css -o public/build/comments.css -w", diff --git a/public/index.html b/public/index.html index f8568e2..d7636ab 100644 --- a/public/index.html +++ b/public/index.html @@ -13,7 +13,7 @@ -
+
diff --git a/src/App.svelte b/src/App.svelte index d794585..f1d1f5d 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -4,12 +4,12 @@ const postPath = window.location.pathname; const hostURL = window.location.host; export let appUrl; - export let loadMore; + export let clickToLoad; const Props = { hostURL, postPath, - loadMore, + clickToLoad, }; diff --git a/src/components/AllComments.svelte b/src/components/AllComments.svelte index 2219ffb..c35cb4d 100644 --- a/src/components/AllComments.svelte +++ b/src/components/AllComments.svelte @@ -4,11 +4,11 @@ import { generateFromString } from "generate-avatar"; export let postPath; let loading = true; - export let loadMore; - let enableLoadMore; + export let clickToLoad; + let enableclickToLoad; export const comments = async () => { - enableLoadMore = false; + enableclickToLoad = false; const { data, error } = await supabase .from("comments") .select() @@ -27,10 +27,10 @@ } }; - if (loadMore) { - enableLoadMore = true; + if (clickToLoad) { + enableclickToLoad = true; } else { - enableLoadMore = false; + enableclickToLoad = false; comments(); } @@ -42,7 +42,7 @@

User Comments

- {#if enableLoadMore} + {#if enableclickToLoad}