aboutsummaryrefslogtreecommitdiff
path: root/components/anime/mobile/reused/description.js
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-09-13 00:45:53 +0700
committerGitHub <[email protected]>2023-09-13 00:45:53 +0700
commit7327a69b55a20b99b14ee0803d6cf5f8b88c45ef (patch)
treecbcca777593a8cc4b0282e7d85a6fc51ba517e25 /components/anime/mobile/reused/description.js
parentUpdate issue templates (diff)
downloadmoopa-7327a69b55a20b99b14ee0803d6cf5f8b88c45ef.tar.xz
moopa-7327a69b55a20b99b14ee0803d6cf5f8b88c45ef.zip
Update v4 - Merge pre-push to main (#71)
* Create build-test.yml * initial v4 commit * update: github workflow * update: push on branch * Update .github/ISSUE_TEMPLATE/bug_report.md * configuring next.config.js file
Diffstat (limited to 'components/anime/mobile/reused/description.js')
-rw-r--r--components/anime/mobile/reused/description.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/components/anime/mobile/reused/description.js b/components/anime/mobile/reused/description.js
new file mode 100644
index 0000000..99973d3
--- /dev/null
+++ b/components/anime/mobile/reused/description.js
@@ -0,0 +1,44 @@
+export default function Description({
+ info,
+ readMore,
+ setReadMore,
+ className,
+}) {
+ return (
+ <div className={`${className} relative md:py-2 z-40`}>
+ <div
+ className={`${
+ info?.description?.replace(/<[^>]*>/g, "").length > 240
+ ? ""
+ : "pointer-events-none"
+ } ${
+ readMore ? "hidden" : ""
+ } absolute z-30 flex items-end justify-center top-0 w-full h-full transition-all duration-200 ease-linear md:opacity-0 md:hover:opacity-100 bg-gradient-to-b from-transparent to-primary to-95%`}
+ >
+ <button
+ type="button"
+ disabled={readMore}
+ onClick={() => setReadMore(!readMore)}
+ className="text-center font-bold text-gray-200 py-1 w-full"
+ >
+ Read {readMore ? "Less" : "More"}
+ </button>
+ </div>
+ <p
+ className={`${
+ readMore
+ ? "text-start md:h-[90px] md:overflow-y-scroll md:scrollbar-thin md:scrollbar-thumb-secondary md:scrollbar-thumb-rounded"
+ : "md:line-clamp-2 line-clamp-3 md:text-start text-center"
+ } text-sm md:text-base font-light antialiased font-karla leading-6`}
+ style={{
+ scrollbarGutter: "stable",
+ }}
+ dangerouslySetInnerHTML={{
+ __html: readMore
+ ? info?.description
+ : info?.description?.replace(/<[^>]*>/g, ""),
+ }}
+ />
+ </div>
+ );
+}