Skip to content

Commit

Permalink
change in homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiganesh authored Oct 7, 2023
1 parent 0405dde commit 6eab5ba
Showing 1 changed file with 44 additions and 109 deletions.
153 changes: 44 additions & 109 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,114 +1,49 @@
import Head from 'next/head'
import Image from 'next/image'
import { Inter } from 'next/font/google'
import styles from '@/styles/Home.module.css'
async function get_stats(){

const inter = Inter({ subsets: ['latin'] })

export default function Home() {
const inputfieldname = document.getElementById("username")
const username = inputfieldname.value

console.log(username)
const player_details_url = `https://api.chess.com/pub/player/${username}`
const player_details_response = await fetch(player_details_url)

const player_details = await player_details_response.json();

document.querySelector("#avatar_image").src = player_details.avatar
document.querySelector("#avatar_name").innerHTML = player_details.name





let dictionary = {
photo : player_details.avatar,
name : player_details.name,
username: player_details.username,
location: player_details.location,
league : player_details.league
}




return dictionary

}

function Chess(){

return (
<>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className={`${styles.main} ${inter.className}`}>
<div className={styles.description}>
<p>
Get started by editing&nbsp;
<code className={styles.code}>pages/index.js</code>
</p>
<div>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className={styles.vercelLogo}
width={100}
height={24}
priority
/>
</a>
</div>
</div>

<div className={styles.center}>
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>

<div className={styles.grid}>
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Docs <span>-&gt;</span>
</h2>
<p>
Find in-depth information about Next.js features and&nbsp;API.
</p>
</a>

<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Learn <span>-&gt;</span>
</h2>
<p>
Learn about Next.js in an interactive course with&nbsp;quizzes!
</p>
</a>

<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Templates <span>-&gt;</span>
</h2>
<p>
Discover and deploy boilerplate example Next.js&nbsp;projects.
</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Deploy <span>-&gt;</span>
</h2>
<p>
Instantly deploy your Next.js site to a shareable URL
with&nbsp;Vercel.
</p>
</a>
</div>
</main>
</>
<div>
<label>Name</label>
<input type="text" name="name" id="username" onChange={get_stats}/>

<img src="" id="avatar_image"></img>
<p1 id="avatar_name"></p1>

</div>
)
}

export default Chess

0 comments on commit 6eab5ba

Please sign in to comment.