import React, { createContext } from 'react'
import './End.css'
import tr from './img/img_end.jpg';


// import { Link } from 'react-router-dom';

function End() {
    let a = []
    for (let i = 0; i < 3; i++) {
        if (localStorage.getItem('답' + (i + 1)) === localStorage.getItem('정답' + (i + 1))) {
            a[i] = 1
            localStorage.setItem('채점' + (i + 1), 'O')
        }
        else {
            a[i] = 0
            localStorage.setItem('채점' + (i + 1), 'X')
        }
    }

    return (
        <>
            <div className="card" >
                <div className='card-header'>
                    -채점표-
                <div className='card-body'>
                        <h3 className='card-title'>이름 : {localStorage.getItem('name')}</h3>


                        <p className='card-text'>Quiz 1 : {localStorage.getItem('채점1')}</p>
                        <p className='card-text'>Quiz 2 : {localStorage.getItem('채점2')}</p>
                        <p className='card-text'>Quiz 3 : {localStorage.getItem('채점3')}</p>
                        <p className='card-text'>Total Score : {a[0] + a[1] + a[2]}</p>
                    </div>
                    <div style={{ marginTop: '100px' }} className="Box text-center">
                        <img src={tr} alt="수고" />

                    </div>
                </div>
            </div>
        </>

    )
}

export default End;
