join -> jsxJoin
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
51c112fd82
commit
9f227893b1
3 changed files with 6 additions and 6 deletions
|
@ -29,7 +29,7 @@ import defaultDispatcher from '../../../dispatcher/dispatcher';
|
||||||
import { RightPanelPhases } from '../../../stores/RightPanelStorePhases';
|
import { RightPanelPhases } from '../../../stores/RightPanelStorePhases';
|
||||||
import { Action } from '../../../dispatcher/actions';
|
import { Action } from '../../../dispatcher/actions';
|
||||||
import { SetRightPanelPhasePayload } from '../../../dispatcher/payloads/SetRightPanelPhasePayload';
|
import { SetRightPanelPhasePayload } from '../../../dispatcher/payloads/SetRightPanelPhasePayload';
|
||||||
import { join } from '../../../utils/ReactUtils';
|
import { jsxJoin } from '../../../utils/ReactUtils';
|
||||||
import { EventType } from 'matrix-js-sdk/src/@types/event';
|
import { EventType } from 'matrix-js-sdk/src/@types/event';
|
||||||
|
|
||||||
const onPinnedMessagesClick = (): void => {
|
const onPinnedMessagesClick = (): void => {
|
||||||
|
@ -138,7 +138,7 @@ export default class MemberEventListSummary extends React.Component<IProps> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return join(summaries, ", ");
|
return jsxJoin(summaries, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { _t } from '../languageHandler';
|
import { _t } from '../languageHandler';
|
||||||
import { join } from './ReactUtils';
|
import { jsxJoin } from './ReactUtils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* formats numbers to fit into ~3 characters, suitable for badge counts
|
* formats numbers to fit into ~3 characters, suitable for badge counts
|
||||||
|
@ -114,9 +114,9 @@ export function formatCommaSeparatedList(items: Array<string | JSX.Element>, ite
|
||||||
return items[0];
|
return items[0];
|
||||||
} else if (remaining > 0) {
|
} else if (remaining > 0) {
|
||||||
items = items.slice(0, itemLimit);
|
items = items.slice(0, itemLimit);
|
||||||
return _t("%(items)s and %(count)s others", { items: join(items, ', '), count: remaining } );
|
return _t("%(items)s and %(count)s others", { items: jsxJoin(items, ', '), count: remaining } );
|
||||||
} else {
|
} else {
|
||||||
const lastItem = items.pop();
|
const lastItem = items.pop();
|
||||||
return _t("%(items)s and %(lastItem)s", { items: join(items, ', '), lastItem: lastItem });
|
return _t("%(items)s and %(lastItem)s", { items: jsxJoin(items, ', '), lastItem: lastItem });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import React from "react";
|
||||||
* @param joiner the string/JSX.Element to join with
|
* @param joiner the string/JSX.Element to join with
|
||||||
* @returns the joined array
|
* @returns the joined array
|
||||||
*/
|
*/
|
||||||
export function join(array: Array<string | JSX.Element>, joiner?: string | JSX.Element): JSX.Element {
|
export function jsxJoin(array: Array<string | JSX.Element>, joiner?: string | JSX.Element): JSX.Element {
|
||||||
const newArray = [];
|
const newArray = [];
|
||||||
array.forEach((element, index) => {
|
array.forEach((element, index) => {
|
||||||
newArray.push(element, (index === array.length - 1) ? null : joiner);
|
newArray.push(element, (index === array.length - 1) ? null : joiner);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue