From 41c08a37159eb24c1bf34cb2c15dae03fed179bd Mon Sep 17 00:00:00 2001 From: Umar Abid <75561750+umrkhn@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:42:56 +0500 Subject: [PATCH] [GH-25020] Add new resource links to [Help (?) drop-down menu] & icons (#25070) * fix: add resource links Help (?) dropdown * fix: refactor styles and update link url * update: i18n and snapshot * fix: update style and refactor * fix: i18n * fix: update test snapshot * Update webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap * Update webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap * Update webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap * Update webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/user_guide_dropdown.tsx --------- Co-authored-by: Carrie Warner (Mattermost) <74422101+cwarnermm@users.noreply.github.com> Co-authored-by: Mattermost Build --- .../user_guide_dropdown.test.tsx.snap | 63 ++++++++++++++----- .../user_guide_dropdown.tsx | 27 +++++--- .../src/components/widgets/menu/menu.scss | 2 +- .../widgets/menu/menu_items/menu_item.scss | 16 +++++ .../menu/menu_items/menu_item_action.tsx | 3 + .../menu_items/menu_item_external_link.tsx | 4 +- webapp/channels/src/i18n/en.json | 2 + 7 files changed, 93 insertions(+), 24 deletions(-) diff --git a/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap b/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap index 6fa728c63a..5a81689165 100644 --- a/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap +++ b/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/__snapshots__/user_guide_dropdown.test.tsx.snap @@ -49,6 +49,21 @@ exports[`components/channel_header/components/UserGuideDropdown should match sna > + + - + + + - { return ( { return ( + + {this.props.helpLink && ( + + )} {this.props.enableAskCommunityLink === 'true' && ( )} - {this.props.helpLink && ( - - )} {this.props.reportAProblemLink && ( )} diff --git a/webapp/channels/src/components/widgets/menu/menu.scss b/webapp/channels/src/components/widgets/menu/menu.scss index 775094540f..3636ba3a73 100644 --- a/webapp/channels/src/components/widgets/menu/menu.scss +++ b/webapp/channels/src/components/widgets/menu/menu.scss @@ -3,7 +3,7 @@ .dropdown-menu { display: block; - min-width: 220px; + min-width: 225px; max-width: 270px; max-height: 80vh; padding: 8px 0; diff --git a/webapp/channels/src/components/widgets/menu/menu_items/menu_item.scss b/webapp/channels/src/components/widgets/menu/menu_items/menu_item.scss index 69e2e9758e..63ff4b941a 100644 --- a/webapp/channels/src/components/widgets/menu/menu_items/menu_item.scss +++ b/webapp/channels/src/components/widgets/menu/menu_items/menu_item.scss @@ -91,6 +91,22 @@ text-overflow: ellipsis; white-space: nowrap; + i.icon { + padding: 0 3px; + margin-right: 4px; + margin-bottom: 2px; + color: rgba(var(--center-channel-color-rgb), 0.72); + vertical-align: middle; + + &::before { + margin: 0; + } + } + + i.icon + span.MenuItem__primary-text { + padding: 5px 4px; + } + &.disabled { color: rgba(var(--center-channel-color-rgb), 0.48); cursor: default; diff --git a/webapp/channels/src/components/widgets/menu/menu_items/menu_item_action.tsx b/webapp/channels/src/components/widgets/menu/menu_items/menu_item_action.tsx index 975a5f23b4..25c8c3390e 100644 --- a/webapp/channels/src/components/widgets/menu/menu_items/menu_item_action.tsx +++ b/webapp/channels/src/components/widgets/menu/menu_items/menu_item_action.tsx @@ -17,6 +17,7 @@ type Props = { isDangerous?: boolean; disabled?: boolean; sibling?: React.ReactNode; + iconClassName?: string; } export const MenuItemActionImpl = ({ onClick, @@ -29,6 +30,7 @@ export const MenuItemActionImpl = ({ isDangerous, disabled, sibling, + iconClassName, }: Props) => ( <> diff --git a/webapp/channels/src/components/widgets/menu/menu_items/menu_item_external_link.tsx b/webapp/channels/src/components/widgets/menu/menu_items/menu_item_external_link.tsx index 0e60410fe7..02531acdf5 100644 --- a/webapp/channels/src/components/widgets/menu/menu_items/menu_item_external_link.tsx +++ b/webapp/channels/src/components/widgets/menu/menu_items/menu_item_external_link.tsx @@ -11,13 +11,15 @@ type Props = { url: string; text: React.ReactNode; onClick?: (event: React.MouseEvent) => void; + iconClassName?: string; } -export const MenuItemExternalLinkImpl: React.FC = ({url, text, onClick}: Props) => ( +export const MenuItemExternalLinkImpl: React.FC = ({url, text, iconClassName, onClick}: Props) => ( + {iconClassName && } {text} diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index a0756bdadf..a196a96efa 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -5657,7 +5657,9 @@ "userGuideHelp.askTheCommunity": "Ask the community", "userGuideHelp.helpResources": "Help resources", "userGuideHelp.keyboardShortcuts": "Keyboard shortcuts", + "userGuideHelp.mattermostUserGuide": "Mattermost user guide", "userGuideHelp.reportAProblem": "Report a problem", + "userGuideHelp.trainingResources": "Training resources", "version_bar.new": "A new version of Mattermost is available.", "version_bar.refresh": "Refresh the app now", "view_image_popover.download": "Download",