From 206f65e67dbd49d89cf0516ab1119264d2b128bd Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 31 Aug 2022 09:18:18 -0700 Subject: [PATCH] Use ContactPills in StoriesSettingsModal --- .../components/StoriesSettingsModal.scss | 23 +-------- ts/components/ContactPills.tsx | 12 ++++- ts/components/StoriesSettingsModal.tsx | 50 ++++++++----------- 3 files changed, 32 insertions(+), 53 deletions(-) diff --git a/stylesheets/components/StoriesSettingsModal.scss b/stylesheets/components/StoriesSettingsModal.scss index a2f7448e9638..59e5fc82d9fd 100644 --- a/stylesheets/components/StoriesSettingsModal.scss +++ b/stylesheets/components/StoriesSettingsModal.scss @@ -203,28 +203,9 @@ &__tags { margin: 0 -4px; - } - &__tag { - align-items: center; - background: $color-gray-75; - border-radius: 26px; - color: $color-gray-05; - display: inline-flex; - padding: 4px 0; - margin: 0 4px; - - &__name { - margin-left: 4px; - } - - &__remove { - @include button-reset; - @include color-svg('../images/icons/v2/x-24.svg', $color-gray-15); - height: 12px; - margin: 0 8px; - width: 12px; - } + // Override .module-ContactPills + padding: 0; } &__name-story-avatar-container { diff --git a/ts/components/ContactPills.tsx b/ts/components/ContactPills.tsx index 08ea6eb76d35..6d0da62b98ce 100644 --- a/ts/components/ContactPills.tsx +++ b/ts/components/ContactPills.tsx @@ -3,15 +3,20 @@ import type { FunctionComponent, ReactNode } from 'react'; import React, { useRef, useEffect, Children } from 'react'; +import classNames from 'classnames'; import { usePrevious } from '../hooks/usePrevious'; import { scrollToBottom } from '../util/scrollUtil'; type PropsType = { + moduleClassName?: string; children?: ReactNode; }; -export const ContactPills: FunctionComponent = ({ children }) => { +export const ContactPills: FunctionComponent = ({ + moduleClassName, + children, +}) => { const elRef = useRef(null); const childCount = Children.count(children); @@ -26,7 +31,10 @@ export const ContactPills: FunctionComponent = ({ children }) => { }, [childCount, previousChildCount]); return ( -
+
{children}
); diff --git a/ts/components/StoriesSettingsModal.tsx b/ts/components/StoriesSettingsModal.tsx index 1074e567ccd3..6a5611c83055 100644 --- a/ts/components/StoriesSettingsModal.tsx +++ b/ts/components/StoriesSettingsModal.tsx @@ -16,6 +16,8 @@ import { Avatar, AvatarSize } from './Avatar'; import { Button, ButtonVariant } from './Button'; import { Checkbox } from './Checkbox'; import { ConfirmationDialog } from './ConfirmationDialog'; +import { ContactPills } from './ContactPills'; +import { ContactPill } from './ContactPill'; import { ConversationList, RowType } from './ConversationList'; import { Input } from './Input'; import { Intl } from './Intl'; @@ -807,38 +809,26 @@ export const EditDistributionList = ({ value={searchTerm} /> {selectedContacts.length ? ( -
+ {selectedContacts.map(contact => ( -
- - - {contact.firstName || - contact.profileName || - contact.phoneNumber} - -
+ toggleSelectedConversation(contact.id)} + /> ))} -
+ ) : undefined} {candidateConversations.length ? (