From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED, URIBL_DBL_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1695416362; bh=9ePtEbeaVb6/FVO2+TZWQO0vTKszpJI7mh4kh9kvbTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y0rP4wH37o5wfiwKfcAg9abe9AwhnIsR9iDK7dadUdxfpaDjXckdVtUFpGKGTbmkX 6/TnjwZUuoyhBxtW9IWtMwIRWlLq6/jtAus5rDkLWQsg3S44jY7b0PEyT24+4DWL5g d8BTKrh073Y/eHKqJHK05HC5xOiJmHgvKUMm6OOvTVdisLeTkm2W3fcwCIgGWB+AHu pz2IB7l/BsljuvwA5MlEDCqu5d7wRcig+7O+WMIE6lO+Fy+XEe5Mw6/ZvRTrOS5tbi rNBQV+T/smaWIbQfCxfJZ319/tFoDIBA77skV14vQxHtSTouJAT2mQ0g2Scb3JJzoi DGtXoFLpufmSg== Received: from localhost.localdomain (unknown [175.158.50.129]) by gnuweeb.org (Postfix) with ESMTPSA id 96D0E24B693; Sat, 23 Sep 2023 03:59:20 +0700 (WIB) From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , Arthur Lapz , Memet Zx , GNU/Weeb Mailing List Subject: [PATCH v1 08/11] feat(page): add `renderMemberList()` function Date: Sat, 23 Sep 2023 03:58:14 +0700 Message-Id: <20230922205817.107-9-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20230922205817.107-1-kiizuha@gnuweeb.org> References: <20230922205817.107-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This commit adds `renderMemberList()` function which is responsible for rendering the organization members' data obtained from `getOrgMembers()` Signed-off-by: Muhammad Rizki --- index.html | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/index.html b/index.html index 26e4043..63c3a7a 100644 --- a/index.html +++ b/index.html @@ -309,6 +309,36 @@ return data; } + + async function renderMemberList() { + const membersData = await getOrgMembers(); + const memberList = document.getElementById("member-list"); + + membersData.forEach(e => { + const userAnchorEl = document.createElement("a"); + userAnchorEl.href = e.html_url; + userAnchorEl.classList.add( + "flex", "items-center", "space-x-3", + "p-1", "rounded-lg", "hover:bg-neutral-800" + ); + + const userImgEl = document.createElement("img"); + userImgEl.src = e.avatar_url; + userImgEl.alt = `${e.login} | Organization Member`; + userImgEl.classList.add("rounded-full", "w-10"); + + const usernameDivEl = document.createElement("div"); + usernameDivEl.classList.add("truncate", "text-sky-500"); + usernameDivEl.innerText = `@${e.login}` + userAnchorEl.appendChild(userImgEl); + userAnchorEl.appendChild(usernameDivEl); + memberList.appendChild(userAnchorEl); + }); + } + + document.addEventListener("DOMContentLoaded", function() { + renderMemberList(); + }); -- Muhammad Rizki