import StudentsCountChart from './students-count-chart';
import {useStudentsCountData} from '../../hooks/student';
import Loader from '../shared/loader';
import Error from '../shared/error';

function StudentsCountContainer() {
  const {isLoading, isError, data, error} = useStudentsCountData();

  if (isLoading) return <Loader />;
  if (isError) return <Error error={error} />;

  return (
    <div className='relative mx-auto h-[45vh] w-[80vw] sm:h-[60vh] md:h-[80vh]'>
      <StudentsCountChart studentsData={data} />
    </div>
  );
}

export default StudentsCountContainer;
