Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to Custom inputdropdown component #354

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading