Skip to content

Commit

Permalink
Add system dropdown filter function (#349)
Browse files Browse the repository at this point in the history
* add special styling for success button (variant=success is deperecated in designsystemet)

* add filter function for system combobox, so it is possible to filter by system name, org name and org nr

* minor css fix
  • Loading branch information
mgunnerud authored Aug 28, 2024
1 parent 50960d9 commit cfee7d6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
border-color: var(--border-color);
background-color: var(--background-color);
margin-top: var(--fds-spacing-2);
overflow: hidden;
}

.actionBar.clickable {
Expand Down Expand Up @@ -61,6 +60,7 @@
font-size: var(--font_size-300);
color: inherit;
word-break: break-word;
border-radius: inherit;
}

.actionBarHeader:focus-visible {
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/features/creationpage/CreationPageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export const CreationPageContent = () => {
navigate(AuthenticationRoute.RightsIncluded);
};

const isStringMatch = (inputString: string, matchString: string): boolean => {
return matchString.toLowerCase().indexOf(inputString.toLowerCase()) >= 0;
};

return (
<div className={classes.creationPageContainer}>
<div>
Expand All @@ -54,6 +58,16 @@ export const CreationPageContent = () => {
);
}
}}
filter={(inputValue: string, option) => {
const vendor = vendors?.find((x) => x.systemId === option.value);
if (!vendor) {
return false;
}
const isOrgNrMatch = isStringMatch(inputValue, vendor.systemVendorOrgNumber);
const isOrgNameMatch = isStringMatch(inputValue, vendor.systemVendorOrgName);
const isSystemNameMatch = isStringMatch(inputValue, vendor.systemName);
return isOrgNrMatch || isOrgNameMatch || isSystemNameMatch;
}}
value={selectedSystemType ? [selectedSystemType] : undefined}
>
{vendors?.map((vendor) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
margin-top: var(--fds-spacing-22);
gap: var(--fds-spacing-4);
}

.successButton {
background-color: var(--fds-semantic-surface-success-default);
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ export const RightsIncludedPageContent = () => {
<div className={classes.buttonContainer}>
<Button
size='small'
color='success'
variant='primary'
onClick={handleConfirm}
disabled={isCreatingSystemUser}
className={classes.successButton}
>
{isCreatingSystemUser && (
<Spinner size='small' title={t('authent_includedrightspage.creating_systemuser')} />
Expand Down

0 comments on commit cfee7d6

Please sign in to comment.