ghost-portal/packages/page-bounties/src/helpers/stringHelpers.ts
MiZiet 708aa6cf95
Add tooltips for bounty status (#4450)
* Add BountyStatusDisplay component

* Implement help tooltip in BountyStatusDisplay

* Add BountyStatusDisplay translations

* Add styling to BountyStatusDisplay

* Update translations

* Add missing types

* Add missing translation

* Update local imports

* Update local imports

* Rename BountyStatusDisplay to BountyStatusView

* Rewrite bounty status helpers

* Add review suggestion

* Change useMemo to useRef in BountyStatusView
2021-01-20 15:33:23 +01:00

13 lines
438 B
TypeScript

// Copyright 2017-2021 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
export function insertSpaceBeforeCapitalLetter (str: string): string {
return str.replace(/([a-z])([A-Z])/g, '$1 $2');
}
export function truncateTitle (str: string, maxLength: number): string {
const ellipsis = String.fromCharCode(8230);
return (str.length > maxLength) ? str.substr(0, maxLength - 1) + ellipsis : str;
}