mirror of
https://github.com/yude-jp/yude.jp
synced 2024-12-22 20:20:09 +09:00
Add player's head on online players listing
This commit is contained in:
parent
636863883a
commit
cb460b9b7f
@ -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>
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user