refactor(forms): enhance grid layout and responsiveness across multiple components
- Updated grid classes in CreateAdmin, CreateCompany, CreateCompanyCategory, CreateCustomer, and CreateNotification components to improve responsiveness. - Adjusted FormFooter and ListHeader components for better layout handling on different screen sizes.
This commit is contained in:
@@ -30,7 +30,7 @@ const CreateAdminForm: FC<IProps> = ({ defaultValues, editMode, id }) => {
|
|||||||
<div className="flex flex-col gap-9">
|
<div className="flex flex-col gap-9">
|
||||||
<ShowcaseSection
|
<ShowcaseSection
|
||||||
title="Input Fields"
|
title="Input Fields"
|
||||||
className="grid grid-cols-2 gap-5"
|
className="grid grid-cols-1 gap-5 md:grid-cols-2"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
@@ -241,7 +241,9 @@ const CreateAdminForm: FC<IProps> = ({ defaultValues, editMode, id }) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormFooter />
|
<div className="md:col-span-2">
|
||||||
|
<FormFooter />
|
||||||
|
</div>
|
||||||
</ShowcaseSection>
|
</ShowcaseSection>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const CreateCompany = ({ defaultValues, editMode, id }: IProps) => {
|
|||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<form
|
<form
|
||||||
className="grid grid-cols-1 items-start gap-9 rounded-xl bg-gray-1 p-10 dark:bg-gray-7 sm:grid-cols-2"
|
className="grid grid-cols-1 items-start gap-9 rounded-xl bg-gray-1 p-10 dark:bg-gray-7 md:grid-cols-2"
|
||||||
onSubmit={handleSubmit(onSubmit)}
|
onSubmit={handleSubmit(onSubmit)}
|
||||||
>
|
>
|
||||||
<div className="flex flex-col gap-9">
|
<div className="flex flex-col gap-9">
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ const CreateCompanyCategoryForm = ({ defaultValues, editMode, id }: IProps) => {
|
|||||||
<form className="grid grid-cols-1 gap-9" onSubmit={handleSubmit(onSubmit)}>
|
<form className="grid grid-cols-1 gap-9" onSubmit={handleSubmit(onSubmit)}>
|
||||||
<ShowcaseSection
|
<ShowcaseSection
|
||||||
title="Create Company Category"
|
title="Create Company Category"
|
||||||
className="grid grid-cols-2 gap-5"
|
className="grid grid-cols-1 gap-5 md:grid-cols-2"
|
||||||
>
|
>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2 md:col-span-1">
|
||||||
<InputGroup
|
<InputGroup
|
||||||
label="Name"
|
label="Name"
|
||||||
{...register("name", {
|
{...register("name", {
|
||||||
@@ -47,7 +47,7 @@ const CreateCompanyCategoryForm = ({ defaultValues, editMode, id }: IProps) => {
|
|||||||
<p className="mt-1 text-sm text-red-500">{errors.name.message}</p>
|
<p className="mt-1 text-sm text-red-500">{errors.name.message}</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2 md:col-span-1">
|
||||||
<TextAreaGroup
|
<TextAreaGroup
|
||||||
label="Description"
|
label="Description"
|
||||||
{...register("description", {
|
{...register("description", {
|
||||||
@@ -69,7 +69,9 @@ const CreateCompanyCategoryForm = ({ defaultValues, editMode, id }: IProps) => {
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<FormFooter />
|
<div className="md:col-span-2">
|
||||||
|
<FormFooter />
|
||||||
|
</div>
|
||||||
</ShowcaseSection>
|
</ShowcaseSection>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => {
|
|||||||
<form className="grid grid-cols-1 gap-9" onSubmit={handleSubmit(onSubmit)}>
|
<form className="grid grid-cols-1 gap-9" onSubmit={handleSubmit(onSubmit)}>
|
||||||
<ShowcaseSection
|
<ShowcaseSection
|
||||||
title="Create Customer"
|
title="Create Customer"
|
||||||
className="grid grid-cols-2 gap-5"
|
className="grid grid-cols-1 gap-5 md:grid-cols-2"
|
||||||
>
|
>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<InputGroup
|
<InputGroup
|
||||||
@@ -228,7 +228,9 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormFooter />
|
<div className="md:col-span-2">
|
||||||
|
<FormFooter />
|
||||||
|
</div>
|
||||||
</ShowcaseSection>
|
</ShowcaseSection>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const CreateNotificationForm = () => {
|
|||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
<ShowcaseSection
|
<ShowcaseSection
|
||||||
title="Create Notification"
|
title="Create Notification"
|
||||||
className="grid grid-cols-2 gap-5"
|
className="grid grid-cols-1 gap-5 md:grid-cols-2"
|
||||||
>
|
>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<InputGroup
|
<InputGroup
|
||||||
@@ -151,7 +151,7 @@ const CreateNotificationForm = () => {
|
|||||||
<p className="mt-1 text-sm text-red-500">{errors.type.message}</p>
|
<p className="mt-1 text-sm text-red-500">{errors.type.message}</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-2 flex flex-col gap-2">
|
<div className="flex flex-col gap-2 md:col-span-2">
|
||||||
<TextAreaGroup
|
<TextAreaGroup
|
||||||
required
|
required
|
||||||
{...register("description", {
|
{...register("description", {
|
||||||
@@ -165,7 +165,9 @@ const CreateNotificationForm = () => {
|
|||||||
placeholder="Enter description"
|
placeholder="Enter description"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<FormFooter />
|
<div className="md:col-span-2">
|
||||||
|
<FormFooter />
|
||||||
|
</div>
|
||||||
</ShowcaseSection>
|
</ShowcaseSection>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const FormFooter = ({ onCancel }: IProps) => {
|
|||||||
const isMutating = useIsMutating();
|
const isMutating = useIsMutating();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
return (
|
return (
|
||||||
<div className="col-span-2 flex gap-6">
|
<div className="col-span-1 flex gap-6 md:col-span-2">
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isMutating > 0}
|
disabled={isMutating > 0}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const ListHeader = ({
|
|||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const pathName = usePathname();
|
const pathName = usePathname();
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex flex-col-reverse items-center justify-between md:flex-row">
|
||||||
<IsVisible condition={hasFilter}>
|
<IsVisible condition={hasFilter}>
|
||||||
<button
|
<button
|
||||||
onClick={onFilter}
|
onClick={onFilter}
|
||||||
@@ -34,7 +34,7 @@ const ListHeader = ({
|
|||||||
</button>
|
</button>
|
||||||
</IsVisible>
|
</IsVisible>
|
||||||
<IsVisible condition={hasCreate}>
|
<IsVisible condition={hasCreate}>
|
||||||
<button className="mb-5 flex w-fit justify-center self-end rounded-lg bg-primary p-[13px] font-medium text-white hover:bg-opacity-90">
|
<button className="mb-5 flex w-fit justify-center self-end rounded-2xl bg-primary p-3 font-medium text-white hover:bg-opacity-90">
|
||||||
<Link href={`${pathName}/create`}>{createButtonText}</Link>
|
<Link href={`${pathName}/create`}>{createButtonText}</Link>
|
||||||
</button>
|
</button>
|
||||||
</IsVisible>
|
</IsVisible>
|
||||||
|
|||||||
Reference in New Issue
Block a user