Skip to content

Commit 72280dd

Browse files
chrisbobbegnprice
authored andcommitted
WebLink [nfc]: Remove a few no-op ZulipText wrappers in callers' children
And update the jsdoc to mention the `text` prop. The WebLink color will still be applied; note this implementation comment: // Some React node that isn't a React element (a `React.Element`); // e.g., a plain string. The enclosing ZulipText will apply its // styles directly. I think I've thought of a better way for ZulipText's aggressiveDefaultStyles to work, so it's less tricky to think through what styles will get applied; coming up.
1 parent 6db86e4 commit 72280dd

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

src/account-info/CustomProfileFields.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ function CustomProfileFieldRow(props: {|
7070
valueElement = (
7171
<View style={styles.valueView}>
7272
{value.url ? (
73-
<WebLink url={value.url}>
74-
<ZulipText text={value.text} />
75-
</WebLink>
73+
<WebLink url={value.url} text={value.text} />
7674
) : (
7775
<ZulipText text={value.text} />
7876
)}

src/common/WebLink.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const componentStyles = createStyleSheet({
2323
/**
2424
* A button styled like a web link.
2525
*
26-
* Accepts `ZulipText`s, `ZulipTextIntl`s, and strings as children.
26+
* Accepts strings as children or a `text` prop, just like ZulipText.
27+
*
28+
* Also accepts `ZulipText`s and `ZulipTextIntl`s as children.
2729
*
2830
* Note: This sort of messes in those non-string children's business by
2931
* unsetting some of their default style attributes. It does this so that

src/message/ReadReceiptsScreen.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import type { UserOrBot } from '../api/modelTypes';
2424
import LoadingIndicator from '../common/LoadingIndicator';
2525
import WebLink from '../common/WebLink';
2626
import { createStyleSheet } from '../styles';
27-
import ZulipText from '../common/ZulipText';
2827

2928
type Props = $ReadOnly<{|
3029
navigation: AppNavigationProp<'read-receipts'>,
@@ -138,11 +137,7 @@ export default function ReadReceiptsScreen(props: Props): Node {
138137
values: {
139138
num_of_people: displayUserIds.length,
140139
'z-link': chunks => (
141-
<WebLink url={new URL('/help/read-receipts', auth.realm)}>
142-
{chunks.map(chunk => (
143-
<ZulipText>{chunk}</ZulipText>
144-
))}
145-
</WebLink>
140+
<WebLink url={new URL('/help/read-receipts', auth.realm)}>{chunks}</WebLink>
146141
),
147142
},
148143
}

0 commit comments

Comments
 (0)