diff --git a/web/modals/threads/members/add-members-group.react.js b/web/modals/threads/members/add-members-group.react.js new file mode 100644 --- /dev/null +++ b/web/modals/threads/members/add-members-group.react.js @@ -0,0 +1,44 @@ +// @flow + +import * as React from 'react'; + +import type { UserListItem } from 'lib/types/user-types'; + +import AddMembersItem from './add-members-item.react'; +import css from './members-modal.css'; + +type AddMemberItemGroupProps = { + +header: string, + +userInfos: $ReadOnlyArray, + +onUserClick: (userID: string) => void, + +usersAdded: $ReadOnlySet, +}; +function AddMembersItemGroup(props: AddMemberItemGroupProps): React.Node { + const { userInfos, onUserClick, usersAdded, header } = props; + + const sortedUserInfos = React.useMemo(() => { + return [...userInfos].sort((a, b) => a.username.localeCompare(b.username)); + }, [userInfos]); + + const userInfosComponents = React.useMemo( + () => + sortedUserInfos.map(userInfo => ( + + )), + [onUserClick, sortedUserInfos, usersAdded], + ); + + return ( + <> +
{header}:
+ {userInfosComponents} + + ); +} + +export default AddMembersItemGroup; diff --git a/web/modals/threads/members/members-modal.css b/web/modals/threads/members/members-modal.css --- a/web/modals/threads/members/members-modal.css +++ b/web/modals/threads/members/members-modal.css @@ -50,6 +50,12 @@ text-align: center; } +div.addMemberItemsGroupHeader { + font-size: var(--s-font-14); + color: var(--add-members-group-header-color); + margin: 16px; +} + button.addMemberItem { display: flex; flex-direction: row; diff --git a/web/theme.css b/web/theme.css --- a/web/theme.css +++ b/web/theme.css @@ -152,6 +152,7 @@ --arrow-extension-color: var(--shades-black-60); --modal-close-color: var(--shades-black-60); --modal-close-color-hover: var(--shades-white-100); + --add-members-group-header-color: var(--shades-black-60); --add-members-item-color: var(--shades-black-60); --add-members-item-color-hover: var(--shades-white-100); --add-members-item-disabled-color: var(--shades-black-80);