Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions i18n/en-US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ be.rootBreadcrumb = All Files
be.save = Save
# Shown as the title in the sub header while searching.
be.searchBreadcrumb = Search Results
# Aria label for the clear button in the search box.
be.searchClear = Clear search
# Shown as a placeholder in the search box.
be.searchPlaceholder = Search files and folders
# Default label for selected items list in the footer.
Expand Down
238 changes: 238 additions & 0 deletions src/elements/common/__mocks__/mockRecentItems.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
const mockRecentItems = {
next_marker: '',
limit: 100,
order: {
by: 'interacted_at',
direction: 'DESC',
},
entries: [
{
type: 'recent_item',
interaction_type: 'item_preview',
interacted_at: '2025-01-31T13:40:24-08:00',
item: {
type: 'file',
id: '1222291629977',
etag: '1',
name: 'Resume (4).pdf',
size: 69266,
parent: {
type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files',
},
extension: 'pdf',
permissions: {
can_download: true,
can_preview: true,
can_upload: true,
can_comment: true,
can_rename: true,
can_delete: true,
can_share: true,
can_set_share_access: true,
can_invite_collaborator: true,
can_annotate: true,
can_view_annotations_all: true,
can_view_annotations_self: true,
can_create_annotations: true,
can_view_annotations: true,
},
path_collection: {
total_count: 1,
entries: [
{
type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files',
},
],
},
modified_at: '2023-05-24T11:43:41-07:00',
created_at: '2023-05-24T11:43:41-07:00',
modified_by: {
type: 'user',
id: '24991742828',
name: 'GW',
login: 'gw@boxdemo.com',
},
has_collaborations: false,
is_externally_owned: false,
authenticated_download_url: 'https://dl.boxcloud.com/api/2.0/files/1222291629977/content',
is_download_available: true,
representations: {
entries: [
{
representation: 'jpg',
properties: {
dimensions: '1024x1024',
paged: 'false',
thumb: 'false',
},
info: {
url: 'https://api.box.com/2.0/internal_files/1222291629977/versions/1334003366777/representations/jpg_1024x1024',
},
status: {
state: 'success',
},
content: {
url_template:
'https://dl.boxcloud.com/api/2.0/internal_files/1222291629977/versions/1334003366777/representations/jpg_1024x1024/content/{+asset_path}',
},
},
],
},
file_version: {
type: 'file_version',
id: '1334003366777',
sha1: 'c60c18bcdc28ed573f7acb440e5d5f1ca9bd2f59',
},
sha1: 'c60c18bcdc28ed573f7acb440e5d5f1ca9bd2f59',
shared_link: {
url: 'https://app.box.com/s/6wvvmdmgmo9ky62p054zbtgn1ph78els',
download_url: 'https://app.box.com/shared/static/6wvvmdmgmo9ky62p054zbtgn1ph78els.pdf',
vanity_url: null,
vanity_name: null,
effective_access: 'open',
effective_permission: 'can_download',
is_password_enabled: false,
unshared_at: null,
download_count: 0,
preview_count: 0,
access: 'open',
permissions: {
can_preview: true,
can_download: true,
can_edit: false,
},
},
watermark_info: {
is_watermarked: false,
},
},
interaction_shared_link: null,
},
{
type: 'recent_item',
interaction_type: 'item_preview',
interacted_at: '2025-01-28T11:12:18-08:00',
item: {
type: 'file',
id: '1318276254035',
etag: '1',
name: 'Resume (2) (1).pdf',
size: 69266,
parent: {
type: 'folder',
id: '218662304788',
sequence_id: '0',
etag: '0',
name: 'metadataquery',
},
extension: 'pdf',
permissions: {
can_download: true,
can_preview: true,
can_upload: true,
can_comment: true,
can_rename: true,
can_delete: true,
can_share: true,
can_set_share_access: true,
can_invite_collaborator: true,
can_annotate: true,
can_view_annotations_all: true,
can_view_annotations_self: true,
can_create_annotations: true,
can_view_annotations: true,
},
path_collection: {
total_count: 2,
entries: [
{
type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files',
},
{
type: 'folder',
id: '218662304788',
sequence_id: '0',
etag: '0',
name: 'metadataquery',
},
],
},
modified_at: '2023-09-26T14:04:52-07:00',
created_at: '2023-09-26T14:04:52-07:00',
modified_by: {
type: 'user',
id: '24991742828',
name: 'GW',
login: 'gw@boxdemo.com',
},
has_collaborations: false,
is_externally_owned: false,
authenticated_download_url: 'https://dl.boxcloud.com/api/2.0/files/1318276254035/content',
is_download_available: true,
representations: {
entries: [
{
representation: 'jpg',
properties: {
dimensions: '1024x1024',
paged: 'false',
thumb: 'false',
},
info: {
url: 'https://api.box.com/2.0/internal_files/1318276254035/versions/1442246185235/representations/jpg_1024x1024',
},
status: {
state: 'success',
},
content: {
url_template:
'https://dl.boxcloud.com/api/2.0/internal_files/1318276254035/versions/1442246185235/representations/jpg_1024x1024/content/{+asset_path}',
},
},
],
},
file_version: {
type: 'file_version',
id: '1442246185235',
sha1: 'c60c18bcdc28ed573f7acb440e5d5f1ca9bd2f59',
},
sha1: 'c60c18bcdc28ed573f7acb440e5d5f1ca9bd2f59',
shared_link: {
url: 'https://app.box.com/s/4isrn71f96h1q76dluj1a71h6o8d6z17',
download_url: 'https://app.box.com/shared/static/4isrn71f96h1q76dluj1a71h6o8d6z17.pdf',
vanity_url: null,
vanity_name: null,
effective_access: 'open',
effective_permission: 'can_download',
is_password_enabled: false,
unshared_at: null,
download_count: 0,
preview_count: 0,
access: 'open',
permissions: {
can_preview: true,
can_download: true,
can_edit: false,
},
},
watermark_info: {
is_watermarked: false,
},
},
interaction_shared_link: null,
},
],
};
export default mockRecentItems;
53 changes: 0 additions & 53 deletions src/elements/common/header/Header.js

This file was deleted.

46 changes: 46 additions & 0 deletions src/elements/common/header/Header.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import * as React from 'react';
import { useIntl } from 'react-intl';
import { SearchInput } from '@box/blueprint-web';
import Logo from './Logo';
import messages from '../messages';
import { VIEW_FOLDER, VIEW_SEARCH } from '../../../constants';
import type { View } from '../../../common/types/core';

import './Header.scss';

type HeaderProps = {
isHeaderLogoVisible?: boolean,
logoUrl?: string,
onSearch: any,
view: View
};

const Header = ({
isHeaderLogoVisible = true,
view,
onSearch,
logoUrl,
}: HeaderProps) => {
const { formatMessage } = useIntl();
const searchMessage = formatMessage(messages.searchPlaceholder);
const isFolder = view === VIEW_FOLDER;
const isSearch = view === VIEW_SEARCH;

return (
<div className="be-header">
{isHeaderLogoVisible && <Logo url={logoUrl} />}
<div className="be-search">
<SearchInput
disabled={!isFolder && !isSearch}
onChange={onSearch}
placeholder={searchMessage}
searchInputAriaLabel={searchMessage}
searchInputClearAriaLabel={formatMessage(messages.searchClear)}
variant="global"
/>
</div>
</div>
);
};

export default Header;
4 changes: 2 additions & 2 deletions src/elements/common/header/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
flex: 0 0 70px;
align-items: center;
padding: 0 25px 0 0;
background: $almost-white;
border-bottom: 1px solid $bdl-gray-10;
border-bottom: 1px solid var(--border-divider-border);

.be-is-small & {
padding-right: 20px;
}

.be-search {
flex: 1;
max-width: 520px;
padding-left: 20px;
}

Expand Down
Loading