Skip to content

Commit

Permalink
nav [nfc]: Improve a few variable names.
Browse files Browse the repository at this point in the history
Based on the rename of `getStreamColorForNarrow` (previously
`getTitleBackgroundColor`) in a recent commit.
  • Loading branch information
chrisbobbe committed Jan 30, 2021
1 parent aa52b1e commit f2d629d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/chat/ChatScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ export default function ChatScreen(props: Props) {
const sayNoMessages = haveNoMessages && !isFetching;
const showComposeBox = canSendToNarrow(narrow) && !showMessagePlaceholders;

const titleBackgroundColor = useSelector(state => getStreamColorForNarrow(state, narrow));
const streamColor = useSelector(state => getStreamColorForNarrow(state, narrow));

return (
<ActionSheetProvider>
<View style={[componentStyles.screen, { backgroundColor }]}>
<KeyboardAvoider style={styles.flexed} behavior="padding">
<ZulipStatusBar backgroundColor={titleBackgroundColor} />
<ZulipStatusBar backgroundColor={streamColor} />
<ChatNavBar narrow={narrow} editMessage={editMessage} />
<OfflineNotice />
<UnreadNotice narrow={narrow} />
Expand Down
18 changes: 6 additions & 12 deletions src/nav/ChatNavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,21 @@ type Props = $ReadOnly<{|

export default function ChatNavBar(props: Props) {
const { narrow, editMessage } = props;
const backgroundColor = useSelector(state => getStreamColorForNarrow(state, narrow));
const streamColor = useSelector(state => getStreamColorForNarrow(state, narrow));
const color =
backgroundColor === undefined ? BRAND_COLOR : foregroundColorFromBackground(backgroundColor);
streamColor === undefined ? BRAND_COLOR : foregroundColorFromBackground(streamColor);
const spinnerColor =
backgroundColor === undefined ? 'default' : foregroundColorFromBackground(backgroundColor);
streamColor === undefined ? 'default' : foregroundColorFromBackground(streamColor);

return (
<SafeAreaView
mode="padding"
edges={['top', 'right', 'left']}
style={{
borderColor:
backgroundColor === undefined
? 'hsla(0, 0%, 50%, 0.25)'
: Color(backgroundColor).darken(0.1),
streamColor === undefined ? 'hsla(0, 0%, 50%, 0.25)' : Color(streamColor).darken(0.1),
borderBottomWidth: 1,
backgroundColor,
backgroundColor: streamColor,
}}
>
<View
Expand All @@ -53,11 +51,7 @@ export default function ChatNavBar(props: Props) {
<ExtraButton color={color} narrow={narrow} />
<InfoButton color={color} narrow={narrow} />
</View>
<LoadingBanner
spinnerColor={spinnerColor}
backgroundColor={backgroundColor}
textColor={color}
/>
<LoadingBanner spinnerColor={spinnerColor} backgroundColor={streamColor} textColor={color} />
</SafeAreaView>
);
}

0 comments on commit f2d629d

Please sign in to comment.