This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/kvrocks-website.git


The following commit(s) were added to refs/heads/main by this push:
     new 4bef142  Sort userData using code. (#218)
4bef142 is described below

commit 4bef142c8fa2920285573d383eb33c6cb309a5f0
Author: 纪华裕 <[email protected]>
AuthorDate: Mon Apr 15 17:09:00 2024 +0800

    Sort userData using code. (#218)
---
 src/components/UserLogos/index.tsx | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/components/UserLogos/index.tsx 
b/src/components/UserLogos/index.tsx
index 31b47ea..72b86ae 100644
--- a/src/components/UserLogos/index.tsx
+++ b/src/components/UserLogos/index.tsx
@@ -2,8 +2,7 @@ import React from "react"
 import styles from "./index.module.css"
 import Link from "@docusaurus/Link";
 
-// Please sort the data by title in alphabetical order.
-const userData = [
+let userData = [
     { title: 'Ahoy Games', img: '/media/users/ahoygames.png', site: 
'https://www.ahoygames.com/' },
     { title: 'BaiShanCloud', img: '/media/users/baishancloud.png', site: 
'https://intl.baishancloud.com/' },
     { title: 'Baidu', img: '/media/users/baidu.png', site: 
'https://www.baidu.com/' },
@@ -28,6 +27,16 @@ const userData = [
     { title: 'WakaTime', img: '/media/users/wakatime.png', site: 
'https://wakatime.com/' },
 ]
 
+// Sort the data by title in alphabetical order.
+userData.sort((a, b) => {
+    const titleA = a.title.toLowerCase();
+    const titleB = b.title.toLowerCase();
+
+    if (titleA < titleB) return -1;
+    if (titleA > titleB) return 1;
+    return 0;
+});
+
 export default function UserLogos(): JSX.Element {
     return <>
         <div className={styles.imgWrapper}>{

Reply via email to