import List from "./List";
import Loading from "./Loading";

function Hours({ appo, slots, hour, setHour, locationAddress }) {
  if (appo === "loading") {
    return <Loading />;
  } else if (typeof appo === "string") {
    return (
      <p className="text-[#525252] text-[14px] md:text-[16px] font-medium py-[56px]">
        {appo}
      </p>
    );
  } else {
    return (
      <>
        <List slots={slots} hour={hour} setHour={setHour} />
        {locationAddress && (
          <div className="mt-4 p-3 bg-[#F5F5F5] dark:bg-[#2A2A2A] rounded-lg">
            <p className="text-[#616161] dark:text-[#A1A1A1] text-[14px] font-medium mb-1">
              آدرس مطب:
            </p>
            <p className="text-[#3B3B3B] dark:text-[#D7D8ED] text-[14px] font-normal">
              {locationAddress}
            </p>
          </div>
        )}
      </>
    );
  }
}

export default Hours;
