Skip to content

Add/Edit user dialog: aligned roles #1280

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
43 changes: 26 additions & 17 deletions src/components/shared/wizard/SelectContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ import ButtonLikeAnchor from "../ButtonLikeAnchor";
import { ParseKeys } from "i18next";

type Item = {
name: string
[key: string]: unknown
}
name: string;
[key: string]: unknown;
};

/**
* This component renders the select container used for roles and user pages in new group and new user pages.
*/
const SelectContainer = ({
resource,
formikField,
manageable = true
manageable = true,
}: {
resource: {
searchable: boolean,
label: string,
items: Item[]
}
formikField: string
manageable?: boolean,
searchable: boolean;
label: string;
items: Item[];
};
formikField: string;
manageable?: boolean;
}) => {
const { t } = useTranslation();

Expand Down Expand Up @@ -195,7 +195,10 @@ const SelectContainer = ({
{resource.searchable && (
<div className="search-container">
{/* search bar */}
<ButtonLikeAnchor extraClassName="clear" onClick={() => clearSearchField()} />
<ButtonLikeAnchor
extraClassName="clear"
onClick={() => clearSearchField()}
/>
<input
type="text"
id="search"
Expand All @@ -208,7 +211,17 @@ const SelectContainer = ({
/>
</div>
)}
{/*Select with options provided by backend*/}
</div>
</div>
<div className="multi-select-col label-right">
<div className="row">
<label>{t(`${resource.label}.RIGHT` as ParseKeys)}</label>
</div>
</div>
</div>
<div className="multi-select-container">
<div className="multi-select-col">
<div className="row">
<select
multiple
className="available"
Expand Down Expand Up @@ -237,13 +250,9 @@ const SelectContainer = ({
</div>
</div>
</div>

<div className="exchange-icon" />

{/*Select with options chosen by user*/}
<div className="multi-select-col">
<div className="row">
<label>{t(`${resource.label}.RIGHT` as ParseKeys)}</label>
<select
multiple
className="selected"
Expand All @@ -252,7 +261,7 @@ const SelectContainer = ({
onChange={(e) => handleChangeRemove(e)}
value={markedForRemoval}
>
{/* @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type. */}
{/* @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type. */}
{selectedItems.map((item, key) => (
<option key={key} value={item.name}>
{item.name}
Expand Down
6 changes: 6 additions & 0 deletions src/styles/components/_multi-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
}
}

.label-right {
margin-left: 10%;
height: 64px;
align-content: end;
}

.multi-select-col {
width: 45%;
display: block;
Expand Down
Loading