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

casion pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-linkis-website.git


The following commit(s) were added to refs/heads/dev by this push:
     new d4dee631e Adapt mobile terminals for team page (#400)
d4dee631e is described below

commit d4dee631ed9fd02ce4fd80534a92b678a81cff2a
Author: Beacontownfc <[email protected]>
AuthorDate: Mon Jul 4 09:48:53 2022 +0800

    Adapt mobile terminals for team page (#400)
    
    * Adapt mobile terminals for team page
    
    * fix bug
    
    * fix bug
---
 src/components/Contributors.jsx | 74 +++++++++++++++++++++++++++++++++++++++++
 src/components/Contributors.tsx | 38 ---------------------
 2 files changed, 74 insertions(+), 38 deletions(-)

diff --git a/src/components/Contributors.jsx b/src/components/Contributors.jsx
new file mode 100644
index 000000000..d9d337f1c
--- /dev/null
+++ b/src/components/Contributors.jsx
@@ -0,0 +1,74 @@
+import React, { useState, useEffect } from 'react';
+import useIsBrowser from '@docusaurus/useIsBrowser';
+
+export default (props) => {
+    const [contributers, setContributers] = useState([]);
+    useEffect(() => {
+        const repo = props.repo ?? 'apache/incubator-linkis';
+
+        if (!contributers || contributers.length === 0) {
+            
fetch(`https://api.github.com/repos/${repo}/contributors?page=1&per_page=10000`).then(function
 (response) {
+                return response.json();
+            }).then((res) => {
+                setContributers(res);
+            });
+        }
+    });
+    /*let html = '<table>';
+    if (contributers && Array.isArray(contributers)) {
+        contributers.forEach((c, i) => {
+            if (i % 7 === 0) {
+                if (i > 0) {
+                    html += '</tr>';
+                }
+                html += '<tr>';
+            }
+            html += `<td>
+                        <a href="${c.html_url}" target="_blank">
+                            <img src="${c.avatar_url}" height="20" /> 
+                            <span style={{ whiteSpace: 'nowrap' 
}}>@${c.login}</span>
+                        </a>
+                    </td>`;
+            if (i === contributers.length - 1) {
+                html += '</tr>';
+            }
+        });
+    }
+    html += '</table>';*/
+    let element_arr = [];
+    let new_contributers = [];
+    let row = useIsBrowser() && Math.floor(window.innerWidth / 200);
+    contributers.forEach((item, index) => {
+        if((index + 1) % row === 0){
+            element_arr.push(item);
+            new_contributers.push([...element_arr]);
+            element_arr = [];
+        } else {
+            element_arr.push(item);
+        }
+    })
+    new_contributers.push([...element_arr]);
+    return (
+        <table>
+            {new_contributers.map((item, index) => {
+
+                return (
+                    <tr>
+                        {item.map((curv, i) => {
+                            return (
+                                <td>
+                                    <a href={`${curv.html_url}`} 
target="_blank">
+                                        <img src={`${curv.avatar_url}`} 
height="20" /> 
+                                        <span style={{ whiteSpace: 'nowrap' 
}}>{curv.login}</span>
+                                    </a>
+                                </td>
+                            )
+                        })}
+                    </tr>
+                )
+            })}
+        
+        </table>
+    )
+    /*return <div style={{width:'1300px'}} dangerouslySetInnerHTML={{ __html: 
html }}/>;*/
+}
diff --git a/src/components/Contributors.tsx b/src/components/Contributors.tsx
deleted file mode 100644
index 01981ab10..000000000
--- a/src/components/Contributors.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import React, { useState, useEffect } from 'react';
-
-export default (props) => {
-    const [contributers, setContributers] = useState([]);
-    useEffect(() => {
-        const repo = props.repo ?? 'apache/incubator-linkis';
-
-        if (!contributers || contributers.length === 0) {
-            
fetch(`https://api.github.com/repos/${repo}/contributors?page=1&per_page=10000`).then(function
 (response) {
-                return response.json();
-            }).then((res) => {
-                setContributers(res);
-            });
-        }
-    });
-    let html = '<table>';
-    if (contributers && Array.isArray(contributers)) {
-        contributers.forEach((c, i) => {
-            if (i % 7 === 0) {
-                if (i > 0) {
-                    html += '</tr>';
-                }
-                html += '<tr>';
-            }
-            html += `<td>
-                        <a href="${c.html_url}" target="_blank">
-                            <img src="${c.avatar_url}" height="20" /> 
-                            <span style={{ whiteSpace: 'nowrap' 
}}>@${c.login}</span>
-                        </a>
-                    </td>`;
-            if (i === contributers.length - 1) {
-                html += '</tr>';
-            }
-        });
-    }
-    html += '</table>';
-    return <div style={{width:'1300px'}} dangerouslySetInnerHTML={{ __html: 
html }}/>;
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to