-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[web] fix user profile long username bug
Summary: This diff fixes the bug where we had text overflow with longer usernames. To address this I introduced a version of `SingleLine` for `web`. For context here is the `native` version of `SingleLine` https://github.com/CommE2E/comm/blob/master/native/components/single-line.react.js Linear task: https://linear.app/comm/issue/ENG-5372/fix-user-profiles-for-long-usernames Test Plan: Please see screenshots below Before: {F837885} after: {F837886} Reviewers: atul, inka Reviewed By: atul Subscribers: ted, ashoat, tomek, wyilio Differential Revision: https://phab.comm.dev/D9604
- Loading branch information
Showing
4 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.singleLine { | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @flow | ||
|
||
import classNames from 'classnames'; | ||
import * as React from 'react'; | ||
|
||
import { firstLine } from 'lib/utils/string-utils.js'; | ||
|
||
import css from './single-line.css'; | ||
|
||
type Props = { | ||
+children: string, | ||
+className?: string, | ||
}; | ||
|
||
function SingleLine(props: Props): React.Node { | ||
const { children, className } = props; | ||
|
||
const text = firstLine(children); | ||
|
||
const singleLineClassName = classNames([css.singleLine, className]); | ||
|
||
return <div className={singleLineClassName}>{text}</div>; | ||
} | ||
|
||
export default SingleLine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ | |
} | ||
|
||
.usernameContainer { | ||
padding-left: 16px; | ||
margin-left: 16px; | ||
overflow: hidden; | ||
} | ||
|
||
.usernameText { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters