Skip to content
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

feat(message input): DLT-1916 remove dt-icon from message input #490

Merged
merged 4 commits into from
Sep 11, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { action } from '@storybook/addon-actions';
import { createRenderConfig } from '@/common/storybook_utils';
import { createRenderConfig, getIconNames } from '@/common/storybook_utils';
import DtRecipeMessageInput from './message_input.vue';
import DtRecipeMessageInputDefaultTemplate from './message_input_default.story.vue';
import mentionSuggestion from '@/components/rich_text_editor/mention_suggestion';
import channelSuggestion from '@/components/rich_text_editor/channel_suggestion';
import slashCommandSuggestion from '@/components/rich_text_editor/slash_command_suggestion';

const iconsList = getIconNames();

/*
Controls
========
Expand Down Expand Up @@ -40,6 +42,18 @@ export const argTypesData = {
type: 'text',
},
},
sendIcon: {
table: {
type: { summary: 'VNode' },
},
options: iconsList,
control: {
type: 'select',
labels: {
undefined: '(empty)',
},
},
},
top: {
table: {
type: { summary: 'VNode' },
Expand Down Expand Up @@ -174,13 +188,13 @@ export const argsData = {
],
skinTone: 'Default',
},
sendIcon: undefined,
showCharacterLimit: {
count: 1000,
warning: 500,
message: 'You have exceeded the character limit',
},
showSend: {
icon: 'send',
ariaLabel: 'send',
tooltipLabel: 'Send',
},
Expand Down Expand Up @@ -216,6 +230,16 @@ export const Default = {
render: (argsData) => createRenderConfig(DtRecipeMessageInput, DtRecipeMessageInputDefaultTemplate, argsData),
};

export const SendButtonWithText = {
render: (argsData) => createRenderConfig(DtRecipeMessageInput, DtRecipeMessageInputDefaultTemplate, argsData),
args: {
...argsData,
showSend: {
text: 'Save',
},
},
};

export const InitializeWithLineBreaks = {
render: (argsData) => createRenderConfig(DtRecipeMessageInput, DtRecipeMessageInputDefaultTemplate, argsData),
args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
@blur="imagePickerFocus = false"
>
<template #icon>
<dt-icon
name="image"
<dt-icon-image
size="300"
/>
</template>
Expand Down Expand Up @@ -107,8 +106,12 @@
@blur="emojiPickerFocus = false"
>
<template #icon>
<dt-icon
:name="!emojiPickerHovered ? 'satisfied' : 'very-satisfied'"
<dt-icon-very-satisfied
v-if="emojiPickerHovered"
size="300"
/>
<dt-icon-satisfied
v-else
size="300"
/>
</template>
Expand Down Expand Up @@ -182,21 +185,26 @@
:class="[
{
'dt-message-input__send-button--disabled': isSendDisabled,
'd-btn--circle': showSend.icon,
'd-btn--circle': showSendIcon,
},
]"
:aria-label="showSend.ariaLabel"
:aria-disabled="isSendDisabled"
@click="onSend"
>
<template
v-if="showSend.icon"
v-if="showSendIcon"
#icon
>
<dt-icon
:name="showSend.icon"
size="300"
/>
<!-- @slot Slot for send button icon -->
<slot
name="sendIcon"
:icon-size="sendIconSize"
>
<dt-icon-send
:size="sendIconSize"
/>
</slot>
</template>
<template
v-if="showSend.text"
Expand All @@ -219,23 +227,26 @@ import {
} from '@/components/rich_text_editor';
import meetingPill from './meeting_pill/meeting_pill';
import { DtButton } from '@/components/button';
import { DtIcon } from '@/components/icon';
import { DtEmojiPicker } from '@/components/emoji_picker';
import { DtPopover } from '@/components/popover';
import { DtInput } from '@/components/input';
import { DtTooltip } from '@/components/tooltip';
import { DtIconImage, DtIconVerySatisfied, DtIconSatisfied, DtIconSend } from '@dialpad/dialtone-icons/vue2';

export default {
name: 'DtRecipeMessageInput',

components: {
DtButton,
DtEmojiPicker,
DtIcon,
DtInput,
DtPopover,
DtRichTextEditor,
DtTooltip,
DtIconImage,
DtIconVerySatisfied,
DtIconSatisfied,
DtIconSend,
},

mixins: [],
Expand Down Expand Up @@ -414,7 +425,7 @@ export default {
*/
showSend: {
type: [Boolean, Object],
default: () => ({ icon: 'send' }),
default: () => ({}),
},

/**
Expand Down Expand Up @@ -624,6 +635,10 @@ export default {
},

computed: {
showSendIcon () {
return !this.showSend.text;
},

inputLength () {
return this.internalInputValue.length;
},
Expand Down Expand Up @@ -651,6 +666,10 @@ export default {
emojiPickerHovered () {
return this.emojiPickerFocus || this.emojiPickerOpened;
},

sendIconSize () {
return '300';
},
},

watch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@
>
<span v-html="$attrs.top" />
</template>
<template
v-if="$attrs.sendIcon"
#sendIcon="{ iconSize }"
>
<dt-icon
:name="$attrs.sendIcon"
:size="iconSize"
/>
</template>
<template
v-if="$attrs.sendButton"
#sendButton
Expand All @@ -83,9 +92,10 @@

<script>
import DtRecipeMessageInput from './message_input.vue';
import { DtIcon } from '@/components/icon';

export default {
name: 'DtRecipeMessageInputDefault',
components: { DtRecipeMessageInput },
components: { DtRecipeMessageInput, DtIcon },
};
</script>
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { action } from '@storybook/addon-actions';
import { createTemplateFromVueFile } from '@/common/storybook_utils';
import { createTemplateFromVueFile, getIconNames } from '@/common/storybook_utils';
import DtRecipeMessageInput from './message_input.vue';
import DtRecipeMessageInputDefaultTemplate from './message_input_default.story.vue';
import mentionSuggestion from '@/components/rich_text_editor/mention_suggestion';
import channelSuggestion from '@/components/rich_text_editor/channel_suggestion';
import slashCommandSuggestion from '@/components/rich_text_editor/slash_command_suggestion';

const iconsList = getIconNames();

/*
Controls
========
Expand Down Expand Up @@ -40,6 +42,18 @@ export const argTypesData = {
type: 'text',
},
},
sendIcon: {
table: {
type: { summary: 'VNode' },
},
options: iconsList,
control: {
type: 'select',
labels: {
undefined: '(empty)',
},
},
},
top: {
table: {
type: { summary: 'VNode' },
Expand Down Expand Up @@ -174,13 +188,13 @@ export const argsData = {
],
skinTone: 'Default',
},
sendIcon: undefined,
showCharacterLimit: {
count: 1000,
warning: 500,
message: 'You have exceeded the character limit',
},
showSend: {
icon: 'send',
ariaLabel: 'send',
tooltipLabel: 'Send',
},
Expand Down Expand Up @@ -224,6 +238,15 @@ export const Default = {
args: {},
};

export const SendButtonWithText = {
render: DefaultTemplate,
args: {
showSend: {
text: 'Save',
},
},
};

export const InitializeWithLineBreaks = {
render: DefaultTemplate,
args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
@blur="imagePickerFocus = false"
>
<template #icon>
<dt-icon
name="image"
<dt-icon-image
size="300"
/>
</template>
Expand Down Expand Up @@ -105,8 +104,12 @@
@blur="emojiPickerFocus = false"
>
<template #icon>
<dt-icon
:name="!emojiPickerHovered ? 'satisfied' : 'very-satisfied'"
<dt-icon-very-satisfied
v-if="emojiPickerHovered"
size="300"
/>
<dt-icon-satisfied
v-else
size="300"
/>
</template>
Expand Down Expand Up @@ -180,21 +183,26 @@
:class="[
{
'dt-message-input__send-button--disabled': isSendDisabled,
'd-btn--circle': showSend.icon,
'd-btn--circle': showSendIcon,
},
]"
:aria-label="showSend.ariaLabel"
:aria-disabled="isSendDisabled"
@click="onSend"
>
<template
v-if="showSend.icon"
v-if="showSendIcon"
#icon
>
<dt-icon
:name="showSend.icon"
size="300"
/>
<!-- @slot Slot for send button icon -->
<slot
name="sendIcon"
:icon-size="sendIconSize"
>
<dt-icon-send
:size="sendIconSize"
/>
</slot>
</template>
<template
v-if="showSend.text"
Expand All @@ -217,23 +225,26 @@ import {
} from '@/components/rich_text_editor';
import meetingPill from './meeting_pill/meeting_pill';
import { DtButton } from '@/components/button';
import { DtIcon } from '@/components/icon';
import { DtEmojiPicker } from '@/components/emoji_picker';
import { DtPopover } from '@/components/popover';
import { DtInput } from '@/components/input';
import { DtTooltip } from '@/components/tooltip';
import { DtIconImage, DtIconVerySatisfied, DtIconSatisfied, DtIconSend } from '@dialpad/dialtone-icons/vue3';

export default {
name: 'DtRecipeMessageInput',

components: {
DtButton,
DtEmojiPicker,
DtIcon,
DtInput,
DtPopover,
DtRichTextEditor,
DtTooltip,
DtIconImage,
DtIconVerySatisfied,
DtIconSatisfied,
DtIconSend,
},

mixins: [],
Expand Down Expand Up @@ -412,7 +423,7 @@ export default {
*/
showSend: {
type: [Boolean, Object],
default: () => ({ icon: 'send' }),
default: () => ({}),
},

/**
Expand Down Expand Up @@ -622,6 +633,10 @@ export default {
},

computed: {
showSendIcon () {
return !this.showSend.text;
},

inputLength () {
return this.internalInputValue.length;
},
Expand Down Expand Up @@ -649,6 +664,10 @@ export default {
emojiPickerHovered () {
return this.emojiPickerFocus || this.emojiPickerOpened;
},

sendIconSize () {
return '300';
},
},

watch: {
Expand Down
Loading
Loading