mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Chat/drawer ux tweaks (#21032)
- clicking empty area on the header will toggle collapse/expand it - applies a background on hover of the channel title - active state for small buttons - the back button now has the correct icon color when hovered - adds missing focus state for heade buttons icons
This commit is contained in:
parent
bb94cc0251
commit
c7b49a14c7
@ -1,4 +1,4 @@
|
|||||||
<ChatDrawer::Header>
|
<ChatDrawer::Header @toggleExpand={{@drawerActions.toggleExpand}}>
|
||||||
<ChatDrawer::Header::LeftActions />
|
<ChatDrawer::Header::LeftActions />
|
||||||
|
|
||||||
<ChatDrawer::Header::ChannelTitle
|
<ChatDrawer::Header::ChannelTitle
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<ChatDrawer::Header>
|
<ChatDrawer::Header @toggleExpand={{@drawerActions.toggleExpand}}>
|
||||||
<ChatDrawer::Header::LeftActions />
|
<ChatDrawer::Header::LeftActions />
|
||||||
<ChatDrawer::Header::Title @title="chat.direct_message_creator.title" />
|
<ChatDrawer::Header::Title @title="chat.direct_message_creator.title" />
|
||||||
<ChatDrawer::Header::RightActions @drawerActions={{@drawerActions}} />
|
<ChatDrawer::Header::RightActions @drawerActions={{@drawerActions}} />
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
|
{{! template-lint-disable no-invalid-interactive }}
|
||||||
<div
|
<div
|
||||||
role="region"
|
role="region"
|
||||||
aria-label={{i18n "chat.aria_roles.header"}}
|
aria-label={{i18n "chat.aria_roles.header"}}
|
||||||
class="chat-drawer-header"
|
class="chat-drawer-header"
|
||||||
|
{{on "click" @toggleExpand}}
|
||||||
|
title={{if
|
||||||
|
this.chatStateManager.isDrawerExpanded
|
||||||
|
(i18n "chat.collapse")
|
||||||
|
(i18n "chat.expand")
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{{yield}}
|
{{yield}}
|
||||||
</div>
|
</div>
|
@ -0,0 +1,6 @@
|
|||||||
|
import Component from "@glimmer/component";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
|
export default class ChatDrawerHeader extends Component {
|
||||||
|
@service chatStateManager;
|
||||||
|
}
|
@ -1,11 +1,11 @@
|
|||||||
<div class="chat-drawer-header__right-actions">
|
<div class="chat-drawer-header__right-actions">
|
||||||
<div class="chat-drawer-header__top-line">
|
<div class="chat-drawer-header__top-line">
|
||||||
<ChatDrawer::Header::FullPageButton
|
|
||||||
@openInFullPage={{@drawerActions.openInFullPage}}
|
|
||||||
/>
|
|
||||||
<ChatDrawer::Header::ToggleExpandButton
|
<ChatDrawer::Header::ToggleExpandButton
|
||||||
@toggleExpand={{@drawerActions.toggleExpand}}
|
@toggleExpand={{@drawerActions.toggleExpand}}
|
||||||
/>
|
/>
|
||||||
|
<ChatDrawer::Header::FullPageButton
|
||||||
|
@openInFullPage={{@drawerActions.openInFullPage}}
|
||||||
|
/>
|
||||||
<ChatDrawer::Header::CloseButton @close={{@drawerActions.close}} />
|
<ChatDrawer::Header::CloseButton @close={{@drawerActions.close}} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -6,5 +6,9 @@
|
|||||||
}}
|
}}
|
||||||
@class="btn-flat btn-link chat-drawer-header__expand-btn"
|
@class="btn-flat btn-link chat-drawer-header__expand-btn"
|
||||||
@action={{@toggleExpand}}
|
@action={{@toggleExpand}}
|
||||||
@title="chat.collapse"
|
@title={{if
|
||||||
|
this.chatStateManager.isDrawerExpanded
|
||||||
|
"chat.collapse"
|
||||||
|
"chat.expand"
|
||||||
|
}}
|
||||||
/>
|
/>
|
@ -1,5 +1,10 @@
|
|||||||
<ChatDrawer::Header>
|
<ChatDrawer::Header @toggleExpand={{@drawerActions.toggleExpand}}>
|
||||||
<ChatDrawer::Header::Title @title="chat.heading" />
|
<div class="chat-drawer-header__title">
|
||||||
|
<div class="chat-drawer-header__top-line">
|
||||||
|
{{i18n "chat.heading"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ChatDrawer::Header::RightActions @drawerActions={{@drawerActions}} />
|
<ChatDrawer::Header::RightActions @drawerActions={{@drawerActions}} />
|
||||||
</ChatDrawer::Header>
|
</ChatDrawer::Header>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<ChatDrawer::Header>
|
<ChatDrawer::Header @toggleExpand={{@drawerActions.toggleExpand}}>
|
||||||
<ChatDrawer::Header::LeftActions />
|
<ChatDrawer::Header::LeftActions />
|
||||||
|
|
||||||
<ChatDrawer::Header::ChannelTitle
|
<ChatDrawer::Header::ChannelTitle
|
||||||
|
@ -101,17 +101,16 @@ html.rtl {
|
|||||||
|
|
||||||
.chat-drawer-header__left-actions {
|
.chat-drawer-header__left-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-drawer-header__right-actions {
|
.chat-drawer-header__right-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 2rem;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-drawer-header__top-line {
|
.chat-drawer-header__top-line {
|
||||||
height: 2.5rem;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@ -125,14 +124,25 @@ html.rtl {
|
|||||||
.chat-drawer-header__title {
|
.chat-drawer-header__title {
|
||||||
@include ellipsis;
|
@include ellipsis;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
width: auto;
|
||||||
width: 100%;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
padding: 0 0.5rem 0 1rem;
|
padding: 0 0.5rem 0 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
height: 2rem;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.chat-channel-title {
|
.chat-drawer-header__top-line {
|
||||||
padding: 0;
|
padding: 0.25rem;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a.chat-drawer-header__title {
|
||||||
|
&:hover {
|
||||||
|
.chat-drawer-header__top-line {
|
||||||
|
background: var(--primary-low);
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +154,8 @@ html.rtl {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0.25rem;
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -195,13 +207,16 @@ html.rtl {
|
|||||||
&__return-to-channels-btn,
|
&__return-to-channels-btn,
|
||||||
&__full-screen-btn,
|
&__full-screen-btn,
|
||||||
&__expand-btn {
|
&__expand-btn {
|
||||||
max-height: 2.5rem;
|
height: 30px;
|
||||||
height: 100%;
|
width: 30px;
|
||||||
min-width: 40px;
|
|
||||||
width: 40px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
border-radius: 100%;
|
||||||
|
|
||||||
|
&:hover:active {
|
||||||
|
background: var(--primary-low);
|
||||||
|
}
|
||||||
|
|
||||||
.d-icon {
|
.d-icon {
|
||||||
color: var(--primary-low-mid);
|
color: var(--primary-low-mid);
|
||||||
@ -219,13 +234,13 @@ html.rtl {
|
|||||||
|
|
||||||
.d-icon {
|
.d-icon {
|
||||||
background: none;
|
background: none;
|
||||||
color: var(--primary-low-mid);
|
color: var(--primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
.d-icon {
|
.d-icon {
|
||||||
color: var(--primary-high);
|
color: var(--primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ en:
|
|||||||
click_to_join: "Click here to view available channels."
|
click_to_join: "Click here to view available channels."
|
||||||
close: "Close"
|
close: "Close"
|
||||||
collapse: "Collapse Chat Drawer"
|
collapse: "Collapse Chat Drawer"
|
||||||
|
expand: "Expand Chat Drawer"
|
||||||
confirm_flag: "Are you sure you want to flag %{username}'s message?"
|
confirm_flag: "Are you sure you want to flag %{username}'s message?"
|
||||||
deleted: "A message was deleted. [view]"
|
deleted: "A message was deleted. [view]"
|
||||||
hidden: "A message was hidden. [view]"
|
hidden: "A message was hidden. [view]"
|
||||||
|
@ -68,6 +68,18 @@ RSpec.describe "Drawer", type: :system, js: true do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when clicking the drawer's header" do
|
||||||
|
it "collapses the drawer" do
|
||||||
|
visit("/")
|
||||||
|
chat_page.open_from_header
|
||||||
|
expect(page).to have_selector(".chat-drawer.is-expanded")
|
||||||
|
|
||||||
|
page.find(".chat-drawer-header").click
|
||||||
|
|
||||||
|
expect(page).to have_selector(".chat-drawer:not(.is-expanded)")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "when going from drawer to full page" do
|
context "when going from drawer to full page" do
|
||||||
fab!(:channel_1) { Fabricate(:chat_channel) }
|
fab!(:channel_1) { Fabricate(:chat_channel) }
|
||||||
fab!(:channel_2) { Fabricate(:chat_channel) }
|
fab!(:channel_2) { Fabricate(:chat_channel) }
|
||||||
|
Loading…
Reference in New Issue
Block a user