Skip to content

Commit 69b897d

Browse files
authored
fix: link icon in pointer cell not visible when cell is too narrow (#1856)
1 parent 67d10ef commit 69b897d

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/components/BrowserCell/BrowserCell.react.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default class BrowserCell extends Component {
8585
}
8686

8787
content = this.props.onPointerClick ? (
88-
<Pill value={ dataValue } onClick={this.props.onPointerClick.bind(undefined, this.props.value)} followClick={true} />
88+
<Pill value={ dataValue } onClick={this.props.onPointerClick.bind(undefined, this.props.value)} followClick={true} shrinkablePill />
8989
) : (
9090
dataValue
9191
);
@@ -102,7 +102,7 @@ export default class BrowserCell extends Component {
102102
const object = new Parse.Object(v.className);
103103
object.id = v.objectId;
104104
array.push(
105-
<Pill key={i} value={v.objectId} onClick={this.props.onPointerClick.bind(undefined, object)} followClick={true} />
105+
<Pill key={i} value={v.objectId} onClick={this.props.onPointerClick.bind(undefined, object)} followClick={true} shrinkablePill />
106106
);
107107
});
108108
this.copyableValue = content = <ul>
@@ -129,7 +129,7 @@ export default class BrowserCell extends Component {
129129
this.copyableValue = content = JSON.stringify(this.props.value);
130130
} else if (this.props.type === 'File') {
131131
const fileName = this.props.value.url() ? getFileName(this.props.value) : 'Uploading\u2026';
132-
content = <Pill value={fileName} fileDownloadLink={this.props.value.url()} />;
132+
content = <Pill value={fileName} fileDownloadLink={this.props.value.url()} shrinkablePill />;
133133
this.copyableValue = fileName;
134134
} else if (this.props.type === 'ACL') {
135135
let pieces = [];
@@ -159,7 +159,7 @@ export default class BrowserCell extends Component {
159159
} else if (this.props.type === 'Relation') {
160160
content = this.props.setRelation ? (
161161
<div style={{ textAlign: 'center' }}>
162-
<Pill onClick={() => this.props.setRelation(this.props.value)} value='View relation' followClick={true} />
162+
<Pill onClick={() => this.props.setRelation(this.props.value)} value='View relation' followClick={true} shrinkablePill />
163163
</div>
164164
) : (
165165
'Relation'

src/components/Pill/Pill.react.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import styles from 'components/Pill/Pill.scss';
1010
import Icon from "components/Icon/Icon.react";
1111

1212
//TODO: refactor, may want to move onClick outside or need to make onClick able to handle link/button a11y
13-
let Pill = ({ value, onClick, fileDownloadLink, followClick = false }) => (
13+
let Pill = ({ value, onClick, fileDownloadLink, followClick = false, shrinkablePill = false }) => (
1414
<span
1515
className={[
1616
styles.pill,
1717
!followClick && onClick ? styles.action : void 0
1818
].join(" ")}
1919
onClick={!followClick && onClick ? onClick : null}
2020
>
21-
<span className={!followClick && fileDownloadLink ? styles.content : ''}>{value}</span>
21+
<span className={!followClick && fileDownloadLink ? styles.content : shrinkablePill ? styles.pillText : ''}>{value}</span>
2222
{followClick && (
2323
<a onClick={e => !e.metaKey && onClick()}>
2424
<Icon name="right-outline" width={20} height={20} fill="#1669a1" />

src/components/Pill/Pill.scss

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
.pill {
1111
@include MonospaceFont;
12-
display: flex;
13-
justify-content: space-between;
14-
align-items: center;
12+
position: relative;
13+
display: inline-block;
1514
color: #0E69A1;
1615
height: 20px;
1716
line-height: 20px;
@@ -22,6 +21,8 @@
2221
text-overflow: ellipsis;
2322
white-space: nowrap;
2423
& a {
24+
position: absolute;
25+
right: 0;
2526
height: 20px;
2627
width: 20px;
2728
background: #d6e5f2;
@@ -31,6 +32,14 @@
3132
transform: rotate(316deg);
3233
}
3334
}
35+
& .pillText {
36+
position: absolute;
37+
left: 0;
38+
text-overflow: ellipsis;
39+
overflow: hidden;
40+
white-space: nowrap;
41+
width: 75%;
42+
}
3443
}
3544

3645
.content {

0 commit comments

Comments
 (0)