From 2590fa9e642a72ac9e25490eb2b4c656937c5ac0 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Thu, 23 May 2024 17:52:08 -0700 Subject: [PATCH] fix: bugs --- package-lock.json | 10 +++++----- package.json | 2 +- src/assets/scripts/text-toggle.js | 10 ++++++++++ src/assets/styles/components/text-toggle.css | 4 ++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd2e212a..b9e3e48e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "17.0.1", + "version": "17.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "17.0.1", + "version": "17.0.2", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.2.2", @@ -4904,9 +4904,9 @@ } }, "node_modules/minipass": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.1.tgz", - "integrity": "sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" diff --git a/package.json b/package.json index 097ae687..8de000a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "17.0.1", + "version": "17.0.2", "description": "The source for my personal site. Built using 11ty.", "type": "module", "scripts": { diff --git a/src/assets/scripts/text-toggle.js b/src/assets/scripts/text-toggle.js index a7951027..a5977c30 100644 --- a/src/assets/scripts/text-toggle.js +++ b/src/assets/scripts/text-toggle.js @@ -1,6 +1,16 @@ window.onload = () => { const button = document.querySelector('[data-toggle-button]') const content = document.querySelector('[data-toggle-content]') + const text = document.querySelectorAll('[data-toggle-content] p') + const minHeight = 500 // this needs to match the height set on [data-toggle-content].text-toggle-hidden in text-toggle.css + let interiorHeight = 0 + + text.forEach(node => interiorHeight += node.scrollHeight) + + if (interiorHeight < minHeight) { + content.classList.remove('text-toggle-hidden') + button.style.display = 'none' + } button.addEventListener('click', () => { if (content.classList.contains('text-toggle-hidden')) { diff --git a/src/assets/styles/components/text-toggle.css b/src/assets/styles/components/text-toggle.css index db031529..9d958075 100644 --- a/src/assets/styles/components/text-toggle.css +++ b/src/assets/styles/components/text-toggle.css @@ -1,6 +1,6 @@ [data-toggle-content].text-toggle-hidden { position: relative; - height: calc(var(--sizing-3xl) * 5); + height: 500px; overflow: hidden; margin-bottom: var(--sizing-base); } @@ -11,7 +11,7 @@ content: ''; top: 0; left: 0; - box-shadow: inset 0 -100px 50px -60px var(--background-color); + box-shadow: inset 0 -120px 50px -60px var(--background-color); width: 100%; height: 100%; }