Skip to content

Commit 8243452

Browse files
committed
feat(chat): rename bool props and default values to false
1 parent 82fda4d commit 8243452

File tree

5 files changed

+49
-50
lines changed

5 files changed

+49
-50
lines changed

src/components/chat/chat-input.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ export default class IgcChatInputComponent extends LitElement {
3939
);
4040
}
4141

42-
@property({ type: Boolean, attribute: 'enable-attachments' })
43-
public enableAttachments = true;
42+
@property({ type: Boolean, attribute: 'disable-attachments' })
43+
public disableAttachments = false;
4444

45-
@property({ type: Boolean, attribute: 'enable-emoji-picker' })
46-
public enableEmojiPicker = true;
45+
@property({ type: Boolean, attribute: 'disable-emojis' })
46+
public disableEmojis = false;
4747

4848
@query('textarea')
4949
private textInputElement!: HTMLTextAreaElement;
@@ -142,17 +142,17 @@ export default class IgcChatInputComponent extends LitElement {
142142
protected override render() {
143143
return html`
144144
<div class="input-container">
145-
${this.enableAttachments
146-
? html`
145+
${this.disableAttachments
146+
? ''
147+
: html`
147148
<igc-file-input multiple @igcChange=${this.handleFileUpload}>
148149
<igc-icon
149150
slot="file-selector-text"
150151
name="attachment"
151152
collection="material"
152153
></igc-icon>
153154
</igc-file-input>
154-
`
155-
: ''}
155+
`}
156156
157157
<div class="input-wrapper">
158158
<igc-textarea
@@ -166,13 +166,13 @@ export default class IgcChatInputComponent extends LitElement {
166166
</div>
167167
168168
<div class="buttons-container">
169-
${this.enableEmojiPicker
170-
? html`
169+
${this.disableEmojis
170+
? ''
171+
: html`
171172
<igc-emoji-picker
172173
@emoji-selected=${this.addEmoji}
173174
></igc-emoji-picker>
174-
`
175-
: ''}
175+
`}
176176
177177
<igc-icon-button
178178
name="send-message"

src/components/chat/chat-message-list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export default class IgcChatMessageListComponent extends LitElement {
3434
@property({ type: Boolean, attribute: 'scroll-bottom' })
3535
public scrollBottom = true;
3636

37-
@property({ type: Boolean, attribute: 'enable-reactions' })
38-
public enableReactions = true;
37+
@property({ type: Boolean, attribute: 'disable-reactions' })
38+
public disableReactions = false;
3939

4040
private formatDate(date: Date): string {
4141
const today = new Date();
@@ -114,7 +114,7 @@ export default class IgcChatMessageListComponent extends LitElement {
114114
<igc-chat-message
115115
.message=${message}
116116
.user=${this.user}
117-
.enableReactions=${this.enableReactions}
117+
.disableReactions=${this.disableReactions}
118118
></igc-chat-message>
119119
`
120120
)}

src/components/chat/chat-message.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export default class IgcChatMessageComponent extends LitElement {
3535
@property({ reflect: true, attribute: false })
3636
public user: IgcUser | undefined;
3737

38-
@property({ type: Boolean, attribute: 'enable-reactions' })
39-
public enableReactions = true;
38+
@property({ type: Boolean, attribute: 'disable-reactions' })
39+
public disableReactions = false;
4040

4141
private formatTime(date: Date | undefined): string | undefined {
4242
return date?.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
@@ -89,6 +89,13 @@ export default class IgcChatMessageComponent extends LitElement {
8989
${this.message?.text.trim()
9090
? html` <div class="bubble">${this.message?.text}</div>`
9191
: ''}
92+
${this.message?.attachments && this.message?.attachments.length > 0
93+
? html`<igc-message-attachments
94+
.attachments=${this.message?.attachments}
95+
>
96+
</igc-message-attachments>`
97+
: ''}
98+
9299
<div class="meta">
93100
<span class="time"
94101
>${this.formatTime(this.message?.timestamp)}</span
@@ -101,21 +108,15 @@ export default class IgcChatMessageComponent extends LitElement {
101108
>`
102109
: ''}
103110
</div>
104-
${this.message?.attachments && this.message?.attachments.length > 0
105-
? html`<igc-message-attachments
106-
.attachments=${this.message?.attachments}
107-
>
108-
</igc-message-attachments>`
109-
: ''}
110111
</div>
111-
${this.enableReactions
112-
? html`<igc-message-reactions
112+
${this.disableReactions
113+
? ''
114+
: html`<igc-message-reactions
113115
.reactions=${this.message?.reactions}
114116
.messageId=${this.message?.id}
115117
.currentUserId=${this.isCurrentUser() ? sender?.id : ''}
116118
@add-reaction=${this.handleAddReaction}
117-
></igc-message-reactions>`
118-
: ''}
119+
></igc-message-reactions>`}
119120
</div>
120121
`;
121122
}

src/components/chat/chat.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ export default class IgcChatComponent extends EventEmitterMixin<
4949
@property({ type: Boolean, attribute: 'scroll-bottom' })
5050
public scrollBottom = true;
5151

52-
@property({ type: Boolean, attribute: 'enable-reactions' })
53-
public enableReactions = true;
52+
@property({ type: Boolean, attribute: 'disable-reactions' })
53+
public disableReactions = false;
5454

55-
@property({ type: Boolean, attribute: 'enable-attachments' })
56-
public enableAttachments = true;
55+
@property({ type: Boolean, attribute: 'disable-attachments' })
56+
public disableAttachments = false;
5757

58-
@property({ type: Boolean, attribute: 'enable-emoji-picker' })
59-
public enableEmojiPicker = true;
58+
@property({ type: Boolean, attribute: 'disable-emojis' })
59+
public disableEmojis = false;
6060

6161
@property({ type: String, attribute: 'header-text', reflect: true })
6262
public headerText = '';
@@ -173,12 +173,12 @@ export default class IgcChatComponent extends EventEmitterMixin<
173173
.user=${this.user}
174174
.typingUsers=${this.typingUsers}
175175
.scrollBottom=${this.scrollBottom}
176-
.enableReactions=${this.enableReactions}
176+
.disableReactions=${this.disableReactions}
177177
>
178178
</igc-chat-message-list>
179179
<igc-chat-input
180-
.enableAttachments=${this.enableAttachments}
181-
.enableEmojiPicker=${this.enableEmojiPicker}
180+
.disableAttachments=${this.disableAttachments}
181+
.disableEmojis=${this.disableEmojis}
182182
@message-send=${this.handleSendMessage}
183183
></igc-chat-input>
184184
</div>

stories/chat.stories.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ const metadata: Meta<IgcChatComponent> = {
1616
control: 'boolean',
1717
table: { defaultValue: { summary: 'true' } },
1818
},
19-
enableReactions: {
19+
disableReactions: {
2020
type: 'boolean',
2121
control: 'boolean',
22-
table: { defaultValue: { summary: 'true' } },
22+
table: { defaultValue: { summary: 'false' } },
2323
},
24-
enableAttachments: {
24+
disableAttachments: {
2525
type: 'boolean',
2626
control: 'boolean',
27-
table: { defaultValue: { summary: 'true' } },
27+
table: { defaultValue: { summary: 'false' } },
2828
},
29-
enableEmojiPicker: {
29+
disableEmojis: {
3030
type: 'boolean',
3131
control: 'boolean',
32-
table: { defaultValue: { summary: 'true' } },
32+
table: { defaultValue: { summary: 'false' } },
3333
},
3434
headerText: {
3535
type: 'string',
@@ -39,9 +39,9 @@ const metadata: Meta<IgcChatComponent> = {
3939
},
4040
args: {
4141
scrollBottom: true,
42-
enableReactions: true,
43-
enableAttachments: true,
44-
enableEmojiPicker: true,
42+
disableReactions: false,
43+
disableAttachments: false,
44+
disableEmojis: false,
4545
headerText: '',
4646
},
4747
};
@@ -50,9 +50,9 @@ export default metadata;
5050

5151
interface IgcChatArgs {
5252
scrollBottom: boolean;
53-
enableReactions: boolean;
54-
enableAttachments: boolean;
55-
enableEmojiPicker: boolean;
53+
disableReactions: boolean;
54+
disableAttachments: boolean;
55+
disableEmojis: boolean;
5656
headerText: string;
5757
}
5858
type Story = StoryObj<IgcChatArgs>;
@@ -69,14 +69,12 @@ const otherUser: any = {
6969
id: 'user2',
7070
name: 'Alice',
7171
avatar: 'https://www.infragistics.com/angular-demos/assets/images/men/2.jpg',
72-
isTyping: false,
7372
};
7473

7574
const thirdUser: any = {
7675
id: 'user3',
7776
name: 'Sam',
7877
avatar: 'https://www.infragistics.com/angular-demos/assets/images/men/3.jpg',
79-
isTyping: false,
8078
};
8179

8280
const initialMessages: any[] = [

0 commit comments

Comments
 (0)