0
0
mirror of https://github.com/yude-jp/yude.jp synced 2024-12-22 12:10:11 +09:00

Add player's head on online players listing

This commit is contained in:
yude 2021-06-02 08:15:01 +09:00
parent 636863883a
commit cb460b9b7f
Signed by: yude
GPG Key ID: EB0FE5D925C4A968

View File

@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react';
import useTranslation from 'next-translate/useTranslation'
import { useRouter } from 'next/router'
import axios from 'axios';
import Image from 'next/image'
import { list } from 'postcss';
export default function Minecraft(props) {
const router = useRouter()
@ -46,6 +48,19 @@ export default function Minecraft(props) {
return <span>{loading}</span>
}
})()}
{(() => {
if (data.players && data.players.list){
var list = [];
var url = [];
for (var i in data.players.list){
url.push('https://mc-heads.net/avatar/' + data.players.list[i])
}
for (var i in url){
list.push(<Image src={url[i]} className="inline" height="50" width="50" />)
}
return <div>{list}</div>
}
})()}
</p>
)
}