Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
feat: Fixes #390. Show shortened version if account name over 25 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfschoen committed Jan 24, 2019
1 parent 1fd1b98 commit 48d64e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
color: $black;
font-weight: 500;
margin-bottom: 0.1rem;
white-space: nowrap;

/**
* Information component when used with components
Expand Down
6 changes: 5 additions & 1 deletion packages/fether-ui/src/AccountCard/Name/Name.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ import PropTypes from 'prop-types';

import { Placeholder } from '../../Placeholder';

const MAX_ACCOUNT_NAME_LENGTH = 25;

export const Name = ({ name, screen, ...otherProps }) => (
<div
className={`account_name ${screen !== 'accounts' ? '-header' : ''}`}
{...otherProps}
>
{name || <Placeholder height={18} width={100} />}
{name.length > MAX_ACCOUNT_NAME_LENGTH
? `${name.substring(0, MAX_ACCOUNT_NAME_LENGTH)}...`
: name || <Placeholder height={14} width={100} />}
</div>
);

Expand Down

0 comments on commit 48d64e4

Please sign in to comment.