Skip to content

Commit

Permalink
design:improve design and bug fixed ui/ux
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadhasanii committed Mar 12, 2024
1 parent 7d163d3 commit e379fdd
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 140 deletions.
63 changes: 0 additions & 63 deletions components/Footer/index.jsx

This file was deleted.

8 changes: 4 additions & 4 deletions components/Home/LazyBook.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default function LazyBookComponent() {
return (
<div className="flex space-x-2 justify-center items-center bg-transparent mt-[10%] dark:invert">
<div className="flex space-x-2 justify-center items-center bg-transparent mt-[50%] lg:mt-[15%] ">
<span className="sr-only">Loading...</span>
<div className="h-6 w-6 bg-[#16a34a] rounded-full animate-bounce [animation-delay:-0.3s]"></div>
<div className="h-6 w-6 bg-[#16a34a] rounded-full animate-bounce [animation-delay:-0.15s]"></div>
<div className="h-6 w-6 bg-[#16a34a] rounded-full animate-bounce"></div>
<div className="h-4 w-4 bg-[#16a34a] rounded-full animate-bounce [animation-delay:-0.3s]"></div>
<div className="h-4 w-4 bg-[#16a34a] rounded-full animate-bounce [animation-delay:-0.15s]"></div>
<div className="h-4 w-4 bg-[#16a34a] rounded-full animate-bounce"></div>
</div>
);
}
14 changes: 6 additions & 8 deletions components/Home/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useRouter } from "next/router";
import React, { useEffect, useState } from "react";
import { last_search } from "../../services/search";
import { AiOutlineSearch } from "react-icons/ai";
import LogoApplication from "./Logo";
import Select from "../common/Select";
import { AxiosInstance } from "../../utils/http";
import SingleRowBook from "./SingleRowBook";
Expand Down Expand Up @@ -123,9 +122,8 @@ export default function MainComponent() {
return (
<>
<div className="row">
<div className="lg:hidden">
<LogoApplication />
</div>



<form
className="md:mb-8 lg:w-2/3 mx-auto flex flex-col md:flex-row md:items-center mb-4 lg:mt-8 mt-1 lg:px-0 sm:px-4 "
Expand All @@ -138,7 +136,7 @@ export default function MainComponent() {
defaultValue={currentLibraryId}
onChange={(v) => setCurrentLibraryId(Number(v))}
ClassName={
"md:w-1/4 text-gray-900 rounded-lg bg-gray-50 border border-gray-300 focus:ring-green-500 focus:border-green-500 "
"md:w-1/4 text-gray-700 rounded-lg bg-gray-50 border border-gray-300 focus:ring-1 focus:outline-none focus:ring-green-500 focus:border-green-500 "
}
/>
<Select
Expand All @@ -150,7 +148,7 @@ export default function MainComponent() {
}}
label={"انتخاب همه دسته ها"}
ClassName={
"md:w-1/4 lg:mx-4 mx-0 mt-1 text-gray-900 rounded-lg bg-gray-50 border border-gray-300 focus:ring-green-500 focus:border-green-500 "
"md:w-1/4 lg:mx-4 mx-0 mt-1 text-gray-700 rounded-lg bg-gray-50 border focus:ring-1 focus:outline-none border-gray-300 focus:ring-green-500 focus:border-green-500 "
}
/>

Expand All @@ -159,7 +157,7 @@ export default function MainComponent() {
autoComplete="off"
type="search"
id="default-search"
className=" py-5 pr-5 pl-10 w-full md:text-base outline-none text-sm rounded-lg text-gray-900 bg-gray-50 border border-gray-300 focus:ring-green-500 focus:border-green-500"
className=" py-5 pr-5 pl-10 w-full md:text-base outline-none focus:ring-1 text-sm rounded-lg text-gray-900 bg-gray-50 border border-gray-300 focus:ring-green-500 focus:border-green-500"
placeholder={"جست و جو در بین 40 هزار جلد کتاب"}
onChange={(e) => setCurrentBookName(e.target.value)}
value={currentBookName}
Expand Down Expand Up @@ -212,7 +210,7 @@ export default function MainComponent() {
قبلی
</button>
)}
{/* Next Button */}

<button
onClick={bookSearchLoading}
className="inline-flex justify-center items-center gap-x-2 text-center bg-white border hover:border-gray-300 text-sm text-green-600 hover:text-green-700 font-medium hover:shadow-sm rounded-full focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 focus:ring-offset-white transition py-3 px-4 "
Expand Down
4 changes: 2 additions & 2 deletions components/Home/PageBook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import LazyBookComponent from "./LazyBook";

import Pn from "persian-number";
import Head from "next/head";

import Image from "next/image";

export default function PageBook({ id }) {
Expand Down Expand Up @@ -117,7 +117,7 @@ export default function PageBook({ id }) {

<div className="flex flex-wrap -mx-2 mb-12 mt-10">
<div className="w-full md:w-2/3 px-2 mb-2 md:mb-0">
<a className="block py-4 px-2 leading-8 font-heading font-medium tracking-tighter text-xl text-white text-center bg-green-600 focus:ring-2 focus:ring-green-500 focus:ring-opacity-50 hover:bg-green-600 rounded-xl">
<a className="block py-4 px-2 text-sm font-heading tracking-tighter text-white text-center bg-green-600 focus:ring-2 focus:ring-green-500 focus:ring-opacity-50 hover:bg-green-600 rounded-xl">
{allbooks.totalEntity > 0 ? (
<span className="font-semibold text-gray-100">
کتاب موجود است و میتوانید حضوری کتاب را امانت بگیرید
Expand Down
2 changes: 1 addition & 1 deletion components/Home/SingleRowBook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function SingleRowBook(props) {
placeholder="blur"
blurDataURL="YOUR_GENERATED_BLURHASH_STRING"
quality={1}
layout="responsive"
layout="fill"
objectFit="contain"
className="rounded-md"
/>
Expand Down
4 changes: 2 additions & 2 deletions components/Layout/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function NavbarComponent({ url }) {
}, [url]);
return (
<>
<header className="hidden w-full lg:px-36 lg:block flex-wrap sm:justify-start sm:flex-nowrap z-50 bg-transparent border-b shadow-lg rounded-lg text-sm py-2 dark:bg-slate-900 dark:border-gray-700">
<header className=" w-full p-4 lg:px-36 lg:block flex-wrap sm:justify-start sm:flex-nowrap z-50 bg-transparent border-b shadow-lg rounded-lg text-sm py-2 ">
<nav
className="lg:w-2/3 flex basis-full items-center mx-auto "
aria-label="Global"
Expand Down Expand Up @@ -47,7 +47,7 @@ export default function NavbarComponent({ url }) {
<a
id="hs-dropdown-with-header"
type="button"
className="hs-dropdown-toggle inline-flex flex-shrink-0 justify-center items-center gap-2 h-[2.375rem] w-[2.375rem] rounded-full font-medium bg-white text-gray-700 align-middle hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 focus:ring-offset-white transition-all text-xs dark:bg-gray-800 dark:hover:bg-slate-800 dark:text-gray-400 dark:hover:text-white dark:focus:ring-gray-700 dark:focus:ring-offset-gray-800"
className="hs-dropdown-toggle inline-flex flex-shrink-0 justify-center items-center gap-2 h-[2.375rem] w-[2.375rem] rounded-full font-medium bg-white text-gray-700 align-middle hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-green-400 focus:ring-offset-2 focus:ring-offset-white transition-all text-xs dark:bg-gray-800 dark:hover:bg-slate-800 "
>
<img
className="inline-block h-[2.375rem] w-[2.375rem] rounded-full ring-2 ring-white dark:ring-gray-800"
Expand Down
4 changes: 2 additions & 2 deletions components/Login/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";
import ChangePassword from "./ChangePassword";
import { useRouter } from "next/router";
import Toast from "../Toast/Toast";

import { AxiosInstance } from "../../utils/http/index";
import Link from "next/link";
import { toast } from "react-toastify";
Expand All @@ -15,7 +15,7 @@ export default function Login() {
const [changePassword, setChangePassword] = useState(false);
const [login, setLogin] = useState(false);
const [error, setError] = useState(false);
const [phonenumber, setPhonenumber] = useState(false);

const router = useRouter();

const handleOnChange = () => {
Expand Down
119 changes: 67 additions & 52 deletions components/User/SingleReserved.jsx
Original file line number Diff line number Diff line change
@@ -1,76 +1,91 @@
import Link from 'next/link';
import React from 'react'
import Image from "next/image";
import Link from "next/link";
import React from "react";

export default function SingleReserved({ bookname, image, index, expire, returned ,createdAt ,bookId}) {
function setStatus(){
export default function SingleReserved({
bookname,
image,
index,
expire,
returned,
createdAt,
bookId,
}) {
function setStatus() {
switch (returned) {
case "PENDING":
return <span className=" text-orange-500 border border-orange-500 text-sm font-medium px-3 py-0.5 rounded ">انتظار تایید</span>
break;

case "ACTIVE":
return <span className=" text-green-600 border border-green-500 text-sm font-medium px-3 py-0.5 rounded ">امانت فعال </span>
break;


case "REJECT":
return <span className=" text-red-500 border border-red-500 text-sm font-medium px-3 py-0.5 rounded ">رد شده</span>
break;
case "ACTIVE":
return (
<span className=" text-yellow-600 border border-yellow-500 text-sm font-medium px-3 py-0.5 rounded ">
امانت فعال
</span>
);
break;

case "CLOSED":
return <span className=" text-sky-500 border border-sky-500 text-sm font-medium px-3 py-0.5 rounded ">تحویل داده شده</span>
break;
case "CLOSED":
return (
<span className=" text-green-600 border border-green-500 text-sm font-medium px-3 py-0.5 rounded ">
تحویل داده شده
</span>
);
break;
}
}
return (

<li key={index} className=" py-10 sm:py-4">
<div className="flex items-center ">
<div className="flex-shrink-0">
<Link
href={{ pathname: "/book/[id]" }}
as={`/book/${bookId}`}
>
<a>
<img className="w-20 h-28 rounded-sm" src={image} alt="Neil image" />
</a>
<Link href={{ pathname: "/book/[id]" }} as={`/book/${bookId}`}>
<a>
<Image
src={image}
alt="Just a flower"
unoptimized={true}
width={85}

height={100}
blurDataURL="YOUR_GENERATED_BLURHASH_STRING"
quality={20}
layout="intrinsic"
objectFit="contain"
className="rounded-md"
/>
</a>
</Link>

</div>
<div className="flex-1 min-w-0 pr-4">
<Link
href={{ pathname: "/book/[id]" }}
as={`/book/${bookId}`}
>
<a>
<p className="text-sm font-medium text-gray-900 truncate ">
{bookname}
</p>
</a>
<Link href={{ pathname: "/book/[id]" }} as={`/book/${bookId}`}>
<a>
<p className="text-sm font-medium text-gray-900 truncate ">
{bookname}
</p>
</a>
</Link>
<p className="text-xs mt-3 font-medium text-gray-700 truncate ">
کد کتاب : {bookId}
کد کتاب : {bookId}
</p>
<p dir='ltr' className=" text-xs mt-3 font-medium text-gray-900 truncate ">
{expire}: تاریخ امانت کتاب
</p>

<p dir='ltr' className=" text-xs mt-3 font-medium text-gray-900 truncate ">
{createdAt}: موعد تحویل
<p
dir="ltr"
className=" text-xs mt-3 font-medium text-gray-900 truncate "
>
{expire}: تاریخ امانت کتاب
</p>

<p
dir="ltr"
className=" text-xs mt-3 font-medium text-gray-900 truncate "
>
{createdAt}: موعد تحویل
</p>
</div>
<div className="hidden md:block justify-items-start float-left mb-5 text-base font-semibold text-gray-900 ">
{setStatus()}
</div>
<div className="hidden md:block justify-items-start float-left mb-5 text-base font-semibold text-gray-900 ">
{setStatus()}
</div>
</div>
<div className="justify-items-start float-left mb-5 md:hidden text-base font-semibold text-gray-900 ">
<div className="justify-items-start float-left mb-5 md:hidden text-base font-semibold text-gray-900 ">
{setStatus()}
</div>



</li>

)
}
);
}
3 changes: 2 additions & 1 deletion components/User/UserReserved.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
import { AxiosInstance } from "../../utils/http";
import SingleReserved from "./SingleReserved";
import moment from "jalali-moment";
import Pn from "persian-number";

export default function UserReserved() {
const [order, setOrder] = useState([]);
Expand Down Expand Up @@ -53,7 +54,7 @@ export default function UserReserved() {
className="text-sm font-medium text-blue-600 hover:underline "
>
<span className="mt-6 inline-flex items-center justify-center px-2 py-1 mr-2 text-xs leading-none text-white bg-green-600 rounded-full">
{count} امانت فعال
{Pn.convertEnToPe(count)} امانت فعال
</span>
</a>
</div>
Expand Down
9 changes: 5 additions & 4 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import "../styles/globals.css";
import "../styles/style.css";
import Layout from "../components/Layout";
import Footer from "../components/Footer";

import NextNProgress from "nextjs-progressbar";
import { useState } from "react";
import Login from "../components/Login";
import NavbarComponent from "../components/Layout/Navbar";
import { useRouter } from "next/router";
import ApiMiddleware from "../components/Middleware/Up";
import DesktopFooter from "../components/Footer/Desktop";

function MyApp({ Component, pageProps }) {
const [login, setLogin] = useState(true);
Expand All @@ -22,19 +23,19 @@ function MyApp({ Component, pageProps }) {
<NavbarComponent url={nowRouter} />

<NextNProgress
options={{ easing: "ease", speed: 500 }}
options={{ easing: "ease", speed: 700 }}
color="#22c55e"
startPosition={0.3}
stopDelayMs={50}
height={3}
height={4}
showOnShallow={true}
/>
<main className="grid grid-cols-12 mx-auto container md:gap-x-4 min-h-screen">
<div className="col-span-12 md:col-span-12 ">
<Component {...pageProps} />
</div>
</main>
<Footer />
<DesktopFooter />
</Layout>
) : (
<Login />
Expand Down
Loading

0 comments on commit e379fdd

Please sign in to comment.