From dfa914af5a140ff7028b2890c98946c8634b2b52 Mon Sep 17 00:00:00 2001 From: log101 Date: Sun, 28 Jul 2024 20:14:18 +0300 Subject: [PATCH] style: bigger font styles --- src/components/LockedContent/geolocation.ts | 2 +- .../LockedContent => lib}/domUtils.ts | 39 ++++++++++++++++++- src/pages/index.astro | 38 +++++++++--------- src/scripts/index.ts | 37 +----------------- src/scripts/initSelectionMap.ts | 2 +- 5 files changed, 59 insertions(+), 59 deletions(-) rename src/{components/LockedContent => lib}/domUtils.ts (61%) diff --git a/src/components/LockedContent/geolocation.ts b/src/components/LockedContent/geolocation.ts index 406da74..49b2a57 100644 --- a/src/components/LockedContent/geolocation.ts +++ b/src/components/LockedContent/geolocation.ts @@ -7,7 +7,7 @@ import { revealContent, toggleClass, updateText, -} from "./domUtils" +} from "../../lib/domUtils" import { mapLocationSuccessCallback } from "@/scripts/initMap" import { toast } from "@/lib/utils" diff --git a/src/components/LockedContent/domUtils.ts b/src/lib/domUtils.ts similarity index 61% rename from src/components/LockedContent/domUtils.ts rename to src/lib/domUtils.ts index 19f9fc2..eca0596 100644 --- a/src/components/LockedContent/domUtils.ts +++ b/src/lib/domUtils.ts @@ -1,4 +1,4 @@ -import { incrementUnlockCounter } from "./serverUtils" +import { incrementUnlockCounter } from "../components/LockedContent/serverUtils" function updateText(elemId: string, text: string) { const elem = document.getElementById(elemId) @@ -48,6 +48,41 @@ function revealContent() { removeElement("unlock-button-container") } +function validateFileInput(el: HTMLInputElement) { + const files = el.files + + if (!files) return + + if (files.length > 0) { + if (files[0].size > 4 * 1024 * 1024) { + el.setCustomValidity("Dosya boyutu 4 MB'den küçük olmalıdır.") + el.reportValidity() + } else { + el.setCustomValidity("") + } + } +} + +function toggleButton(elemId: string, spinnerId: string) { + const elem = document.getElementById(elemId) as HTMLButtonElement | null + const spinner = document.getElementById(spinnerId) + + if (!elem) { + throw new Error("Element could not be found!") + } else if (elem.disabled) { + spinner?.classList.add("hidden") + removeClasses(elemId, "bg-slate-500") + addClasses(elemId, "bg-slate-900") + elem.disabled = false + } else { + spinner?.classList.remove("hidden") + removeClasses(elemId, "bg-slate-900") + addClasses(elemId, "bg-slate-500") + elem.disabled = true + setTimeout(() => toggleButton(elemId, spinnerId), 1000) + } +} + export { addClasses, removeClasses, @@ -57,4 +92,6 @@ export { updateInputValue, revealContent, addAttribute, + validateFileInput, + toggleButton, } diff --git a/src/pages/index.astro b/src/pages/index.astro index 82fe7a6..436b4d9 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -11,7 +11,7 @@ import { Loader2 } from "lucide-react"
@@ -19,19 +19,19 @@ import { Loader2 } from "lucide-react" class='scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl hover:underline'> Konulu Konum -

+

3 basit adımda fotoğraflarınızı ve videolarınızı yalnızca belirli bir konumda açılacak şekilde kilitleyin: + > açılacak şekilde kilitleyin.

+ class='mt-10 scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0'> 1. Fotoğraf Seçimi

-

+

Aşağıdaki butona basıp galerinizden bir fotoğraf seçin, seçtiğiniz fotoğraf yalnızca belirli bir konumda açılabilecek bir hale getirilecek. @@ -44,7 +44,7 @@ import { Loader2 } from "lucide-react" class='p-2 border border-gray rounded-lg file:bg-inherit file:border-0' required /> -

+

Galerinizden bir fotoğraf seçin.

@@ -52,24 +52,24 @@ import { Loader2 } from "lucide-react"

+ class='mt-10 scroll-m-20 border-b pb-2 font-semibold tracking-tight transition-colors first:mt-0 text-3xl'> 2. Fotoğrafın Açılacağı Konum

-

+

Haritadan bir nokta seçin. Bağlantıyı gönderdiğiniz kişi bu konuma gittiği zaman seçtiğiniz fotoğrafı görebilecek.

+ class='w-full h-[450px] rounded mt-6 transition-colors ease-in-out border-2 duration-300'>
-

+

Seçilen Konum:

Henüz konum seçmediniz, konum seçmek için haritadaki bir noktaya basınız. @@ -85,14 +85,12 @@ import { Loader2 } from "lucide-react"

+ class='mt-10 scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0'> 3. Fotoğraf Açıklaması

- +
-
-
+
diff --git a/src/scripts/index.ts b/src/scripts/index.ts index 6e18379..ea53ef4 100644 --- a/src/scripts/index.ts +++ b/src/scripts/index.ts @@ -1,4 +1,4 @@ -import { addClasses, removeClasses } from "@/components/LockedContent/domUtils" +import { toggleButton, validateFileInput } from "@/lib/domUtils" import { toast } from "@/lib/utils" export function toggleMap() { @@ -15,41 +15,6 @@ export function toggleMap() { }, 800) } -export function validateFileInput(el: HTMLInputElement) { - const files = el.files - - if (!files) return - - if (files.length > 0) { - if (files[0].size > 4 * 1024 * 1024) { - el.setCustomValidity("Dosya boyutu 4 MB'den küçük olmalıdır.") - el.reportValidity() - } else { - el.setCustomValidity("") - } - } -} - -function toggleButton(elemId: string, spinnerId: string) { - const elem = document.getElementById(elemId) as HTMLButtonElement | null - const spinner = document.getElementById(spinnerId) - - if (!elem) { - throw new Error("Element could not be found!") - } else if (elem.disabled) { - spinner?.classList.add("hidden") - removeClasses(elemId, "bg-slate-500") - addClasses(elemId, "bg-slate-900") - elem.disabled = false - } else { - spinner?.classList.remove("hidden") - removeClasses(elemId, "bg-slate-900") - addClasses(elemId, "bg-slate-500") - elem.disabled = true - setTimeout(() => toggleButton(elemId, spinnerId), 1000) - } -} - const handleSubmit = async (e: SubmitEvent) => { e.preventDefault() toggleButton("submit-button", "submit-button-spinner") diff --git a/src/scripts/initSelectionMap.ts b/src/scripts/initSelectionMap.ts index 20cea10..8effb6e 100644 --- a/src/scripts/initSelectionMap.ts +++ b/src/scripts/initSelectionMap.ts @@ -10,7 +10,7 @@ import { removeClasses, updateInputValue, updateText, -} from "@/components/LockedContent/domUtils" +} from "@/lib/domUtils" import { updateMarkerLocation } from "@/components/Leaflet/geolocation" var map = L.map("map").setView([41.024857599001905, 28.940787550837882], 10)