@@ -4,41 +4,28 @@ import { Chat } from '@microsoft/microsoft-graph-types';
44import { IGraph , PeoplePicker , Spinner } from '@microsoft/mgt-react' ;
55import {
66 Button ,
7- Divider ,
87 Field ,
98 FluentProvider ,
109 Input ,
1110 InputOnChangeData ,
12- Text ,
1311 Textarea ,
1412 TextareaOnChangeData ,
15- teamsLightTheme ,
1613 makeStyles ,
1714 typographyStyles ,
1815 shorthands ,
19- tokens
16+ webLightTheme
2017} from '@fluentui/react-components' ;
2118import { createChatThread } from '../../statefulClient/graph.chat' ;
2219import { graph } from '../../utils/graph' ;
2320import { currentUserId } from '../../utils/currentUser' ;
2421
2522interface NewChatProps {
26- hideTitle ?: boolean ;
27- title ?: string ;
2823 mode ?: 'oneOnOne' | 'group' | 'auto' ;
2924 onChatCreated : ( chat : Chat ) => void ;
3025 onCancelClicked : ( ) => void ;
3126}
3227
3328const useStyles = makeStyles ( {
34- container : {
35- display : 'flex' ,
36- flexDirection : 'column' ,
37- ...shorthands . paddingBlock ( '3px' , '16px' ) ,
38- minWidth : '300px' ,
39- backgroundColor : tokens . colorNeutralBackground1 ,
40- boxShadow : tokens . shadow8
41- } ,
4229 title : {
4330 ...typographyStyles . subtitle2 ,
4431 ...shorthands . marginInline ( '32px' )
@@ -47,8 +34,7 @@ const useStyles = makeStyles({
4734 display : 'flex' ,
4835 flexDirection : 'column' ,
4936 gridRowGap : '16px' ,
50- marginBlockStart : '16px' ,
51- ...shorthands . marginInline ( '32px' )
37+ minWidth : '300px'
5238 } ,
5339 formButtons : {
5440 display : 'flex' ,
@@ -58,13 +44,7 @@ const useStyles = makeStyles({
5844 }
5945} ) ;
6046
61- const NewChat : FC < NewChatProps > = ( {
62- hideTitle,
63- title,
64- mode = 'auto' ,
65- onChatCreated,
66- onCancelClicked
67- } : NewChatProps ) => {
47+ const NewChat : FC < NewChatProps > = ( { mode = 'auto' , onChatCreated, onCancelClicked } : NewChatProps ) => {
6848 const styles = useStyles ( ) ;
6949 type NewChatState = 'initial' ;
7050
@@ -115,47 +95,37 @@ const NewChat: FC<NewChatProps> = ({
11595 } , [ onChatCreated , selectedPeople , initialMessage , chatName , isGroup ] ) ;
11696
11797 return (
118- < FluentProvider theme = { teamsLightTheme } >
98+ < FluentProvider theme = { webLightTheme } >
11999 { state === 'initial' ? (
120- < div className = { styles . container } >
121- { ! hideTitle && (
122- < >
123- < Text as = "h2" className = { styles . title } >
124- { title ? title : 'New chat' }
125- </ Text >
126- < Divider />
127- </ >
128- ) }
129- < div className = { styles . form } >
130- < Field label = "To" >
131- < PeoplePicker
132- disabled = { ( mode === 'oneOnOne' && selectedPeople ?. length > 0 ) || selectedPeople ?. length > 19 }
133- ariaLabel = "Select people to chat with"
134- selectedPeople = { selectedPeople }
135- selectionChanged = { onSelectedPeopleChange }
136- />
137- </ Field >
138-
139- { isGroup && (
140- < Field label = "Group name" >
141- < Input placeholder = "Chat name" onChange = { onChatNameChanged } value = { chatName } />
142- </ Field >
143- ) }
144- < Textarea
145- placeholder = "Type your first message"
146- size = "large"
147- resize = "vertical"
148- value = { initialMessage }
149- onChange = { onInitialMessageChange }
100+ < div className = { styles . form } >
101+ < Field label = "To" >
102+ < PeoplePicker
103+ disabled = { ( mode === 'oneOnOne' && selectedPeople ?. length > 0 ) || selectedPeople ?. length > 19 }
104+ ariaLabel = "Select people to chat with"
105+ selectedPeople = { selectedPeople }
106+ selectionChanged = { onSelectedPeopleChange }
150107 />
151- < div className = { styles . formButtons } >
152- < Button appearance = "secondary" onClick = { onCancelClicked } >
153- Cancel
154- </ Button >
155- < Button appearance = "primary" onClick = { createChat } >
156- Send
157- </ Button >
158- </ div >
108+ </ Field >
109+
110+ { isGroup && (
111+ < Field label = "Group name" >
112+ < Input placeholder = "Chat name" onChange = { onChatNameChanged } value = { chatName } />
113+ </ Field >
114+ ) }
115+ < Textarea
116+ placeholder = "Type your first message"
117+ size = "large"
118+ resize = "vertical"
119+ value = { initialMessage }
120+ onChange = { onInitialMessageChange }
121+ />
122+ < div className = { styles . formButtons } >
123+ < Button appearance = "secondary" onClick = { onCancelClicked } >
124+ Cancel
125+ </ Button >
126+ < Button appearance = "primary" onClick = { createChat } >
127+ Send
128+ </ Button >
159129 </ div >
160130 </ div >
161131 ) : (
0 commit comments