Skip to content
Snippets Groups Projects
Commit 87d65eb3 authored by Alissa Cheng's avatar Alissa Cheng
Browse files

fix: disabled form components

parent 83375641
No related branches found
No related tags found
1 merge request!32Update form components
Pipeline #74137 passed
...@@ -13,6 +13,7 @@ export type DateArray = [DateNull, DateNull]; ...@@ -13,6 +13,7 @@ export type DateArray = [DateNull, DateNull];
type DateInputProps = { type DateInputProps = {
isRequired?: boolean; isRequired?: boolean;
isDisabled?: boolean;
label: string; label: string;
labelPlacement?: LabelPlacement; labelPlacement?: LabelPlacement;
labelClass?: string; labelClass?: string;
...@@ -31,6 +32,7 @@ type DateInputProps = { ...@@ -31,6 +32,7 @@ type DateInputProps = {
const DateInput = ({ const DateInput = ({
isRequired = false, isRequired = false,
isDisabled = false,
label, label,
labelPlacement = "outside", labelPlacement = "outside",
labelClass = "", labelClass = "",
...@@ -68,6 +70,7 @@ const DateInput = ({ ...@@ -68,6 +70,7 @@ const DateInput = ({
<div onClick={onClick}> <div onClick={onClick}>
<BaseInput <BaseInput
isRequired={isRequired} isRequired={isRequired}
isDisabled={isDisabled}
label={label} label={label}
labelPlacement={labelPlacement} labelPlacement={labelPlacement}
labelClass={labelClass} labelClass={labelClass}
...@@ -184,6 +187,7 @@ const DateInput = ({ ...@@ -184,6 +187,7 @@ const DateInput = ({
popperPlacement={ popperPlacement={
labelPlacement === "outside-left" ? "bottom-end" : "bottom-start" labelPlacement === "outside-left" ? "bottom-end" : "bottom-start"
} }
disabled={isDisabled}
/> />
); );
}; };
......
...@@ -36,6 +36,7 @@ const Dropdown = ({ ...@@ -36,6 +36,7 @@ const Dropdown = ({
return ( return (
<Autocomplete <Autocomplete
isRequired={isRequired} isRequired={isRequired}
isDisabled={isDisabled}
label={ label={
label && ( label && (
<Typography <Typography
......
import { Dispatch, ReactNode, SetStateAction } from "react"; import { Dispatch, ReactNode, SetStateAction } from "react";
import { DataTable, type DataTableValueArray } from "primereact/datatable"; import { DataTable, type DataTableValueArray } from "primereact/datatable";
import { Column } from "primereact/column"; import { Column } from "primereact/column";
import { clsx } from "clsx";
import { textColor } from "./utils/classes.ts"; import { textColor } from "./utils/classes.ts";
import Typography from "./Typography.tsx"; import Typography from "./Typography.tsx";
...@@ -39,7 +40,9 @@ const Table = ({ ...@@ -39,7 +40,9 @@ const Table = ({
reorderableRows={isReorderable} reorderableRows={isReorderable}
onRowReorder={(e) => onReorder && onReorder(e.value)} onRowReorder={(e) => onReorder && onReorder(e.value)}
className="rounded-[8px] bg-lightGrey/30 dark:bg-baseBlack/40 p-[20px] pb-[10px]" className="rounded-[8px] bg-lightGrey/30 dark:bg-baseBlack/40 p-[20px] pb-[10px]"
rowClassName={() => "border-t border-grey/50 text-[13px] font-body"} rowClassName={() =>
clsx("border-t border-grey/50 text-[13px] font-body", textColor("body"))
}
cellClassName={() => "h-12 pl-[5px]"} cellClassName={() => "h-12 pl-[5px]"}
> >
{isSelectable && ( {isSelectable && (
......
...@@ -85,3 +85,13 @@ export const LabelOnTheLeft = () => { ...@@ -85,3 +85,13 @@ export const LabelOnTheLeft = () => {
</div> </div>
); );
}; };
export const Disabled = () => {
return (
<DateInput
label="Can't touch this"
onValueChange={() => {}}
isDisabled={true}
/>
);
};
...@@ -35,3 +35,14 @@ export const SimpleDropdown = () => { ...@@ -35,3 +35,14 @@ export const SimpleDropdown = () => {
</> </>
); );
}; };
export const Disabled = () => {
return (
<Dropdown
label="You can't choose your favourite ice cream."
valueOptions={[]}
onValueChange={() => {}}
isDisabled={true}
/>
);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment