import React, { useEffect, useState } from 'react'
import LoginImg from '../../assets/bg/login.svg'

import MainLoaderBS from '../loaders/MainLoaderBS'
import { Link, useNavigate } from 'react-router-dom'
import siteLinks from '../../links/siteLinks'

export default function Login() {

  const [loading, setLoading] = useState(true)

  const navigate = useNavigate()

  useEffect(()=>{
    const timer = setTimeout(()=>{
        setLoading(false)
    },1000)

    return () => clearTimeout(timer)
  },[])

  return (
    <div className="app">
        <div className="app-wrap">
            <div className="app-contant">
                <div className="bg-white">
                    <div className="container-fluid p-0">
                        <div className="row no-gutters">
                            <div className="col-sm-6 col-lg-5 col-xxl-3  align-self-center order-2 order-sm-1">
                                <div className="d-flex align-items-center h-100-vh">
                                    <div className="login p-50">
                                        <h1 className="mb-2">MERMS Panel</h1>
                                        <p>Welcome back, please login to your account.</p>
                                        <form className="mt-3 mt-sm-5">
                                            <div className="row">
                                                <div className="col-12">
                                                    <div className="form-group">
                                                        <label className="control-label">User Name*</label>
                                                        <input type="text" className="form-control" placeholder="Username" />
                                                    </div>
                                                </div>
                                                <div className="col-12">
                                                    <div className="form-group">
                                                        <label className="control-label">Password*</label>
                                                        <input type="password" className="form-control" placeholder="Password" />
                                                    </div>
                                                </div>
                                                <div className="col-12">
                                                    <div className="d-block d-sm-flex  align-items-center">
                                                        <div className="form-check">
                                                            <input className="form-check-input" type="checkbox" id="gridCheck" />
                                                            <label className="form-check-label" htmlFor="gridCheck">
                                                                Remember Me
                                                            </label>
                                                        </div>
                                                        <Link to={siteLinks.forgetpwd} className="ml-auto">Forgot Password ?</Link>
                                                    </div>
                                                </div>
                                                <div className="col-12 mt-3">
                                                    <button type='button' onClick={()=>{navigate(siteLinks.dash)}} className="btn btn-primary text-uppercase">Sign In</button>
                                                </div>
                                                <div className="col-12  mt-3">
                                                    <p>Don't have an account ?<Link to={siteLinks.signup}> Sign Up</Link></p>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                            <div className="col-sm-6 col-xxl-9 col-lg-7 bg-gradient o-hidden order-1 order-sm-2">
                                <div className="row align-items-center h-100">
                                    <div className="col-7 mx-auto ">
                                        <img className="img-fluid" src={LoginImg} alt="" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
  )
}
