Skip to content

Commit 4824a67

Browse files
authored
Update: Adding option to show the box logo (#24)
Fix: Fix autoFocus issue and add shortcut for breadcrumbs Docs: Update with example app Update: Adding option to show the box logo. If logoUrl = box, then the box logo will show otherwise the default placeholder Fix: Delete functionality in explorer
1 parent 1e4c6a7 commit 4824a67

8 files changed

Lines changed: 85 additions & 60 deletions

File tree

src/components/ContentExplorer/ContentExplorer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ class ContentExplorer extends Component<DefaultProps, Props, State> {
759759
return;
760760
}
761761

762-
const { id, permissions, type }: BoxItem = selected;
763-
if (!id || !permissions || !type) {
762+
const { id, permissions, parent, type }: BoxItem = selected;
763+
if (!id || !permissions || !parent || !type) {
764764
return;
765765
}
766766

src/components/Header/Header.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* @flow
3-
* @file File picker content header
3+
* @file Header bar
44
* @author Box
55
*/
66

77
import React from 'react';
8-
import IconDefaultLogo from '../icons/IconDefaultLogo';
8+
import Logo from './Logo';
99
import { Button } from '../Button';
1010
import { VIEW_FOLDER, VIEW_SEARCH } from '../../constants';
1111
import type { View } from '../../flowTypes';
@@ -28,9 +28,7 @@ const Header = ({ view, searchQuery, canUpload, onSearch, onUpload, logoUrl, get
2828
return (
2929
<div className='buik-header'>
3030
<div className='buik-header-left'>
31-
<div className='buik-logo'>
32-
{logoUrl ? <img alt='' src={logoUrl} className='buik-logo-custom' /> : <IconDefaultLogo />}
33-
</div>
31+
<Logo url={logoUrl} />
3432
<div className='buik-search'>
3533
<input
3634
type='search'

src/components/Header/Header.scss

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,6 @@
1313
padding-right: 20px;
1414
}
1515

16-
.buik-logo {
17-
padding-left: 20px;
18-
19-
.buik-logo-custom {
20-
max-height: 32px;
21-
max-width: 80px;
22-
}
23-
24-
.buik-is-small & {
25-
display: none;
26-
}
27-
28-
svg {
29-
display: block;
30-
}
31-
}
32-
3316
.buik-header-left {
3417
align-items: center;
3518
display: flex;

src/components/Header/Logo.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* @flow
3+
* @file Logo for the header
4+
* @author Box
5+
*/
6+
7+
import React from 'react';
8+
import IconDefaultLogo from '../icons/IconDefaultLogo';
9+
import IconBoxLogo from '../icons/IconBoxLogo';
10+
import './Logo.scss';
11+
12+
type Props = {
13+
url?: string
14+
};
15+
16+
function getLogo(url?: string) {
17+
if (url === 'box') {
18+
return <IconBoxLogo />;
19+
} else if (typeof url === 'string') {
20+
return <img alt='' src={url} className='buik-logo-custom' />;
21+
}
22+
return <IconDefaultLogo />;
23+
}
24+
25+
const Logo = ({ url }: Props) =>
26+
<div className='buik-logo'>
27+
{getLogo(url)}
28+
</div>;
29+
30+
export default Logo;

src/components/Header/Logo.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@import '../variables';
2+
3+
.buik-logo {
4+
padding-left: 20px;
5+
6+
.buik-logo-custom {
7+
max-height: 32px;
8+
max-width: 80px;
9+
}
10+
11+
.buik-is-small & {
12+
display: none;
13+
}
14+
15+
svg {
16+
display: block;
17+
}
18+
}

src/components/icons/IconBoxLogo.js

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,25 @@ import { BOX_BLUE } from '../../constants';
99
import type { IconType } from '../../flowTypes';
1010

1111
const IconBoxLogo = ({ color = BOX_BLUE, height = 25, width = 45 }: IconType) =>
12-
<div>
13-
<svg height={height} width={width} viewBox='0 0 98 52' aria-labelledby='title desc' role='img'>
14-
<path
15-
fill={color}
16-
fillRule='evenodd'
17-
d='M95.34 44.7c1.1 1.53.8 3.66-.75 4.8-1.56
18-
1.13-3.74.84-4.93-.64l-7.8-10.23-7.82 10.23c-1.2 1.48-3.36
19-
1.77-4.9.63-1.55-1.15-1.87-3.28-.75-4.8l9.06-11.86L68.4
20-
21c-1.1-1.54-.8-3.67.75-4.8 1.55-1.14 3.72-.85 4.9.63l7.82 10.23
21-
7.8-10.23c1.2-1.48 3.38-1.77 4.92-.63 1.52 1.13 1.84 3.26.73
22-
4.8L86.3 32.84l9.04 11.85zM53.9 43.22c-5.86 0-10.6-4.65-10.6-10.4
23-
0-5.72 4.74-10.37 10.6-10.37 5.85 0 10.6 4.65 10.6 10.38 0
24-
5.74-4.75 10.4-10.6 10.4zm-31.23 0c-5.85 0-10.6-4.65-10.6-10.4
25-
0-5.72 4.75-10.37 10.6-10.37 5.86 0 10.6 4.65 10.6 10.38 0 5.74-4.74
26-
10.4-10.6 10.4zm31.22-27.7c-6.78 0-12.66 3.73-15.63
27-
9.2-2.97-5.47-8.84-9.2-15.6-9.2-4 0-7.66 1.3-10.6 3.46V4.38C12.02
28-
2.52 10.45 1 8.53 1 6.6 1 5.03 2.5 5 4.4v28.7c.16 9.43 8 17.03
29-
17.67 17.03 6.77 0 12.64-3.73 15.6-9.2 2.98 5.47 8.86 9.2 15.62
30-
9.2 9.74 0 17.66-7.75 17.66-17.32 0-9.55-7.92-17.3-17.68-17.3z'
31-
/>
32-
</svg>
33-
</div>;
12+
<svg height={height} width={width} viewBox='0 0 98 52' role='img'>
13+
<path
14+
fill={color}
15+
fillRule='evenodd'
16+
d='M95.34 44.7c1.1 1.53.8 3.66-.75 4.8-1.56
17+
1.13-3.74.84-4.93-.64l-7.8-10.23-7.82 10.23c-1.2 1.48-3.36
18+
1.77-4.9.63-1.55-1.15-1.87-3.28-.75-4.8l9.06-11.86L68.4
19+
21c-1.1-1.54-.8-3.67.75-4.8 1.55-1.14 3.72-.85 4.9.63l7.82 10.23
20+
7.8-10.23c1.2-1.48 3.38-1.77 4.92-.63 1.52 1.13 1.84 3.26.73
21+
4.8L86.3 32.84l9.04 11.85zM53.9 43.22c-5.86 0-10.6-4.65-10.6-10.4
22+
0-5.72 4.74-10.37 10.6-10.37 5.85 0 10.6 4.65 10.6 10.38 0
23+
5.74-4.75 10.4-10.6 10.4zm-31.23 0c-5.85 0-10.6-4.65-10.6-10.4
24+
0-5.72 4.75-10.37 10.6-10.37 5.86 0 10.6 4.65 10.6 10.38 0 5.74-4.74
25+
10.4-10.6 10.4zm31.22-27.7c-6.78 0-12.66 3.73-15.63
26+
9.2-2.97-5.47-8.84-9.2-15.6-9.2-4 0-7.66 1.3-10.6 3.46V4.38C12.02
27+
2.52 10.45 1 8.53 1 6.6 1 5.03 2.5 5 4.4v28.7c.16 9.43 8 17.03
28+
17.67 17.03 6.77 0 12.64-3.73 15.6-9.2 2.98 5.47 8.86 9.2 15.62
29+
9.2 9.74 0 17.66-7.75 17.66-17.32 0-9.55-7.92-17.3-17.68-17.3z'
30+
/>
31+
</svg>;
3432

3533
export default IconBoxLogo;

src/components/icons/IconDefaultLogo.js

Lines changed: 11 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/pickers.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ <h1>Folder Picker (max 3 items / token generator / no upload)</h1>
209209
});
210210
contentPicker2.show(folderId, tokenGenerator2, {
211211
container: '.contentPicker2',
212-
logoUrl: 'https://d30y9cdsu7xlg0.cloudfront.net/png/12458-200.png',
212+
logoUrl: 'box',
213213
maxSelectable: 1
214214
});
215215
}

0 commit comments

Comments
 (0)