Skip to content

Commit bcec95e

Browse files
authored
Fix: Remove download button on mobile (#4)
Also fixes a few styles
1 parent 3325cb5 commit bcec95e

6 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/components/ContentExplorer/ItemList.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
cursor: pointer;
8181
font-weight: 400;
8282
text-transform: none;
83-
user-select: none;
8483

8584
&:active,
8685
&:hover,

src/components/ContentExplorer/moreOptionsCellRenderer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React from 'react';
88
import DropdownMenu from '../DropdownMenu';
99
import { Menu, MenuItem } from '../Menu';
1010
import { Button } from '../Button';
11-
import type { BoxItem } from '../../flowTypes';
11+
import isMobile from '../../util/mobile';
1212
import {
1313
PERMISSION_CAN_DOWNLOAD,
1414
PERMISSION_CAN_RENAME,
@@ -18,6 +18,7 @@ import {
1818
TYPE_FILE,
1919
TYPE_WEBLINK
2020
} from '../../constants';
21+
import type { BoxItem } from '../../flowTypes';
2122
import './MoreOptionsCell.scss';
2223

2324
export default (
@@ -53,7 +54,7 @@ export default (
5354
const allowDelete = canDelete && permissions[PERMISSION_CAN_DELETE];
5455
const allowShare = canShare && permissions[PERMISSION_CAN_SHARE];
5556
const allowRename = canRename && permissions[PERMISSION_CAN_RENAME];
56-
const allowDownload = canDownload && permissions[PERMISSION_CAN_DOWNLOAD] && type === TYPE_FILE;
57+
const allowDownload = canDownload && permissions[PERMISSION_CAN_DOWNLOAD] && type === TYPE_FILE && !isMobile();
5758
const allowed = allowDelete || allowRename || allowDownload || allowPreview || allowShare || allowOpen;
5859

5960
if (!allowed) {

src/components/Item/ItemName.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import '../variables';
22

3-
.buik-btn.buik-btn-plain.buik-item-label {
3+
.buik-item-label {
44
max-width: 290px;
55
overflow: hidden;
66
text-overflow: ellipsis;

src/components/Item/NameCell.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
line-height: 15px;
55
overflow: hidden;
66
text-align: left;
7+
text-overflow: ellipsis;
78
}

src/components/base.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
padding: 0;
1717
position: relative;
1818
text-rendering: optimizeLegibility;
19+
user-select: none;
1920
width: 100%;
2021

2122
@mixin placeholder {
@@ -233,7 +234,6 @@
233234
cursor: pointer;
234235
display: block;
235236
position: relative;
236-
user-select: none;
237237

238238
> input {
239239
&[type='checkbox'] {

src/util/mobile.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @flow
3+
* @file Helper to get mobile
4+
* @author Box
5+
*/
6+
7+
export default function isMobile() {
8+
// Relying on the user agent to avoid desktop browsers on machines with touch screens.
9+
return /iphone|ipad|ipod|android|blackberry|bb10|mini|windows\sce|palm/i.test(navigator.userAgent);
10+
}

0 commit comments

Comments
 (0)