Skip to content

Commit

Permalink
Merge pull request #354 from fahad-aot/bugfix/Cahngesto-custom-compon…
Browse files Browse the repository at this point in the history
…ents

Updates to Custom inputdropdown component
  • Loading branch information
arun-s-aot authored Nov 27, 2024
2 parents 4000fd8 + 2ef3da1 commit be088cb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export const FormInput: React.FC<FormInputProps> = ({
{icon}
</InputGroup.Text>
)}
{isInvalid && (
</InputGroup>
{isInvalid && (
<Form.Control.Feedback className='custom-feedback' type="invalid">
{feedback}
</Form.Control.Feedback>
)}
</InputGroup>
</Form.Group>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface InputDropdownProps {
setNewInput? : (value: string) => void;
isInvalid?: boolean;
inputClassName?: string;
onBlurDropDown?: () => void;
}

export const InputDropdown: React.FC<InputDropdownProps> = ({
Expand All @@ -43,7 +44,8 @@ export const InputDropdown: React.FC<InputDropdownProps> = ({
dataTestIdforDropdown,
dataTestIdforInput,
isInvalid,
inputClassName=''
inputClassName='',
onBlurDropDown
}) => {
const [isDropdownOpen, setIsDropdownOpen] = useState<boolean>(false);
const [inputValue, setInputValue] = useState<string>(selectedOption || '');
Expand Down Expand Up @@ -78,7 +80,10 @@ export const InputDropdown: React.FC<InputDropdownProps> = ({
const handleInputDropdownChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
setInputValue(value);

if (value === '') {
setNewInput('');
}
//filtering out items
const filtered = Options.filter((item) =>
item.label.toLowerCase().includes(value.toLowerCase())
);
Expand Down Expand Up @@ -138,6 +143,9 @@ export const InputDropdown: React.FC<InputDropdownProps> = ({
onIconClick={toggleDropdown}
label={dropdownLabel}
required={required}
onBlur={onBlurDropDown}
isInvalid={!(isDropdownOpen || selectedOption) && isInvalid}
feedback={feedback}
/>
</InputGroup>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const TableFooter: React.FC<TableFooterProps> = ({
</td>
{pageOptions && (
<td colSpan={3}>
<div className="d-flex align-items-center">
<div className="d-flex align-items-center justify-content-end">
<span className="pagination-text">{t("Rows per page")}</span>
<div className="pagination-dropdown">
<Dropdown data-testid="page-limit-dropdown">
Expand Down
1 change: 1 addition & 0 deletions forms-flow-theme/scss/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ select option:hover {
}

.custom-feedback {
display: flex;
color: var(--ff-red-000);
font-size: var(--font-size-xs);
font-weight: var(--font-weight-sm);
Expand Down
1 change: 0 additions & 1 deletion forms-flow-theme/scss/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ $status-radius: 50%;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
height: 3rem;
line-height: 1.5rem;
color: var(--ff-black);
font-weight: var(--font-weight-sm);
Expand Down

0 comments on commit be088cb

Please sign in to comment.