From 7d0f94c6549abaa04be58b3cae84b6a8c6f75935 Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:44:32 -0400 Subject: [PATCH] Moves panel header into the panel component --- stylesheets/_conversation.scss | 18 ---- .../components/ConversationHeader.scss | 5 - stylesheets/components/ConversationPanel.scss | 99 +++++++++++++++++++ stylesheets/components/ConversationView.scss | 18 +++- stylesheets/manifest.scss | 1 + .../conversation/ConversationHeader.tsx | 71 ++++--------- ts/state/smart/ConversationHeader.tsx | 7 +- ts/state/smart/ConversationPanel.tsx | 26 ++++- 8 files changed, 158 insertions(+), 87 deletions(-) create mode 100644 stylesheets/components/ConversationPanel.scss diff --git a/stylesheets/_conversation.scss b/stylesheets/_conversation.scss index 6378ae313d4b..914e1f6ba62c 100644 --- a/stylesheets/_conversation.scss +++ b/stylesheets/_conversation.scss @@ -36,24 +36,6 @@ background-color: $color-gray-95; } - .panel { - height: calc(100% - #{$header-height} - var(--title-bar-drag-area-height)); - inset-inline-start: 0; - overflow-y: overlay; - position: absolute; - top: calc(#{$header-height} + var(--title-bar-drag-area-height)); - width: 100%; - z-index: $z-index-base; - - @include light-theme() { - background-color: $color-white; - } - - @include dark-theme() { - background-color: $color-gray-95; - } - } - .panel { &:not(.main) { &:dir(ltr) { diff --git a/stylesheets/components/ConversationHeader.scss b/stylesheets/components/ConversationHeader.scss index f8794bbc7230..8ca264c89fe8 100644 --- a/stylesheets/components/ConversationHeader.scss +++ b/stylesheets/components/ConversationHeader.scss @@ -197,7 +197,6 @@ height: $icon-size; margin-inline-end: var(--button-spacing); min-width: $icon-size; - opacity: 0; padding: 2px; transition: margin-inline-end 200ms ease-out, opacity 200ms ease-out, background 100ms ease-out; @@ -207,10 +206,6 @@ cursor: default; } - &--show { - opacity: 1; - } - &--show-disabled { opacity: 0.5; } diff --git a/stylesheets/components/ConversationPanel.scss b/stylesheets/components/ConversationPanel.scss new file mode 100644 index 000000000000..74fbf48b923a --- /dev/null +++ b/stylesheets/components/ConversationPanel.scss @@ -0,0 +1,99 @@ +// Copyright 2023 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +.ConversationPanel { + height: 100%; + inset-inline-start: 0; + overflow-y: overlay; + position: absolute; + top: 0; + width: 100%; + z-index: $z-index-base; + + @include light-theme() { + background-color: $color-white; + } + + @include dark-theme() { + background-color: $color-gray-95; + } + + &__header { + padding-top: var(--title-bar-drag-area-height); + display: flex; + flex-direction: row; + align-items: center; + height: calc(#{$header-height} + var(--title-bar-drag-area-height)); + + @include light-theme { + color: $color-gray-90; + background-color: $color-white; + } + @include dark-theme { + color: $color-gray-02; + background-color: $color-gray-95; + } + + &__info { + display: flex; + flex-direction: column; + min-width: 0; + + &__title { + @include font-body-1-bold; + display: flex; + align-items: center; + + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + user-select: none; + + &__in-contacts-icon { + margin-inline-start: 4px; + } + } + } + + &__back-button { + border: none; + display: inline-block; + height: 20px; + margin-inline: 24px 6px; + min-width: 20px; + opacity: 0; + opacity: 1; + vertical-align: text-bottom; + -webkit-app-region: no-drag; + width: 20px; + + &:disabled { + cursor: default; + } + + @include light-theme { + @include color-svg( + '../images/icons/v3/chevron/chevron-left.svg', + $color-gray-90 + ); + } + @include dark-theme { + @include color-svg( + '../images/icons/v3/chevron/chevron-left.svg', + $color-gray-02 + ); + } + + @include keyboard-mode { + &:focus { + background-color: $color-ultramarine; + } + } + @include dark-keyboard-mode { + &:focus { + background-color: $color-ultramarine-light; + } + } + } + } +} diff --git a/stylesheets/components/ConversationView.scss b/stylesheets/components/ConversationView.scss index 0a703848a3a7..8d5ab3034a21 100644 --- a/stylesheets/components/ConversationView.scss +++ b/stylesheets/components/ConversationView.scss @@ -9,10 +9,21 @@ &__pane { display: flex; flex-direction: column; - height: 100%; - overflow: initial; + height: calc(100% - #{$header-height} - var(--title-bar-drag-area-height)); + inset-inline-start: 0; + overflow-y: overlay; position: absolute; + top: calc(#{$header-height} + var(--title-bar-drag-area-height)); width: 100%; + z-index: $z-index-base; + + @include light-theme() { + background-color: $color-white; + } + + @include dark-theme() { + background-color: $color-gray-95; + } } &__timeline { @@ -44,4 +55,7 @@ margin-inline: 16px; } } + + &__header { + } } diff --git a/stylesheets/manifest.scss b/stylesheets/manifest.scss index 4fe7671e96ab..d2e192c3aa53 100644 --- a/stylesheets/manifest.scss +++ b/stylesheets/manifest.scss @@ -67,6 +67,7 @@ @import './components/ConversationHeader.scss'; @import './components/ConversationHero.scss'; @import './components/ConversationMergeNotification.scss'; +@import './components/ConversationPanel.scss'; @import './components/ConversationView.scss'; @import './components/CustomColorEditor.scss'; @import './components/CustomizingPreferredReactionsModal.scss'; diff --git a/ts/components/conversation/ConversationHeader.tsx b/ts/components/conversation/ConversationHeader.tsx index 4b4a22d05a7b..aa81055675df 100644 --- a/ts/components/conversation/ConversationHeader.tsx +++ b/ts/components/conversation/ConversationHeader.tsx @@ -51,11 +51,10 @@ export enum OutgoingCallButtonStyle { export type PropsDataType = { badge?: BadgeType; cannotLeaveBecauseYouAreLastAdmin: boolean; - conversationTitle?: string; + hasPanelShowing?: boolean; hasStories?: HasStories; isMissingMandatoryProfileSharing?: boolean; outgoingCallButtonStyle: OutgoingCallButtonStyle; - showBackButton?: boolean; isSMSOnly?: boolean; isSignalConversation?: boolean; theme: ThemeType; @@ -161,23 +160,6 @@ export class ConversationHeader extends React.Component { } } - private renderBackButton(): ReactNode { - const { i18n, popPanelForConversation, showBackButton } = this.props; - - return ( -