Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #23391, #23251 - adjust breadcrumbs switcher to pf design #5493

Merged
merged 1 commit into from Jun 19, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .storybook/addons.js
@@ -0,0 +1,2 @@
import '@storybook/addon-actions/register';
import '@storybook/addon-knobs/register';
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -6,6 +6,7 @@
"private": true,
"devDependencies": {
"@storybook/addon-actions": "^3.2.12",
"@storybook/addon-knobs": "^3.4.3",
Copy link
Member

@ohadlevy ohadlevy Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just noticed there is package dep, @ekohl ack? (even if this package is only used to generate the storybook and never used in building the app).

"@storybook/react": "^3.2.12",
"@storybook/storybook-deployer": "^2.0.0",
"axios-mock-adapter": "^1.10.0",
Expand Down
2 changes: 1 addition & 1 deletion webpack/assets/javascripts/react_app/common/colors.scss
Expand Up @@ -10,6 +10,6 @@ $pf-blue-400: #0088ce;
$pf-color-white: #fff;
$pf-border-gray: #d1d1d1;

$switcher-max-height: 300px;
$switcher-max-height: 400px;
$switcher-max-width: 200px;
$switcher-min-width: 200px;
@@ -0,0 +1,37 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { boolean, number, withKnobs } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
import BreadcrumbBar from './BreadcrumbBar';

storiesOf('BreadcrumBar', module)
.addDecorator(withKnobs)
.add('With open switcher', () => (
<BreadcrumbBar
isLoadingResources={boolean('is loading', false)}
loadSwitcherResourcesByResource={action('load switcher data')}
isSwitcherOpen={boolean('is switcher open', true)}
totalPages={number('total pages', 3)}
currentPage={number('current page', 2)}
hasError={boolean('has error', false)}
resourceSwitcherItems={[
{ name: 'item 1', id: 1 },
{ name: 'item 2', id: 2 },
{
name:
'item 3 with a very very very very very very very very long name',
id: 3,
},
]}
data={{
resource: {
resourceUrl: 'some_url',
},
isSwitchable: true,
breadcrumbItems: [
{ caption: 'Index Page', url: '#' },
{ caption: 'Resource Page' },
],
}}
/>
));
Expand Up @@ -58,5 +58,5 @@ export const loadSwitcherResourcesByResource = (resource, { page = 1, searchQuer
};
beforeRequest();

return API.get(resourceUrl, {}, { page, search: searchQuery && `${[nameField]}~${searchQuery}` }).then(onRequestSuccess, onRequestFail);
return API.get(resourceUrl, {}, { page, per_page: 10, search: searchQuery && `${[nameField]}~${searchQuery}` }).then(onRequestSuccess, onRequestFail);
};
Expand Up @@ -75,7 +75,7 @@ const BreadcrumbSwitcherPopover = ({
</ListGroup>
<Pager
className="pager-sm"
messages={{ nextPage: __('Next'), previousPage: __('Previous') }}
messages={{ nextPage: '', previousPage: '' }}
onNextPage={onNextPageClick}
onPreviousPage={onPrevPageClick}
disablePrevious={currentPage === 1}
Expand Down
@@ -1,42 +1,62 @@
@import '../../../common/colors';

.popover-content {
max-height: $switcher-max-height;
overflow-y: auto;
max-width: $switcher-max-width;
min-width: $switcher-max-width;

.fa-spinner {
margin-top: 12px;
}
#breadcrumb-switcher-popover {
z-index: 1000 !important;

.breadcrumb-switcher-popover-error {
color: #f00;
}
.popover-content {
padding-left: 0;
padding-right: 0;
max-height: $switcher-max-height;
overflow: hidden;
max-width: $switcher-max-width;
min-width: $switcher-max-width;

.list-group-item {
padding: 5px 3px;
.fa-spinner {
margin-top: 12px;
}

&:hover {
color: #fff;
background-color: #39a5dc;
border-color: #39a5dc;
.breadcrumb-switcher-popover-error {
text-indent: 10px;
color: #f00;
}
}

.no-border {
border: none;
}
}
.list-group-item {
padding: 5px 3px;
text-indent: 10px;

#breadcrumb-switcher-popover {
z-index: 1000 !important;
}
&:hover {
color: #fff;
background-color: #0089c7;
}

.scrollable-list {
margin-top: 5px;
&.active {
background-color: #0089c7;
}
}

.no-border {
border: none;
}

.pager {
margin: 10px 13px;

a {
width: 22px;
}

&.list-group {
border-top: 0;
.fa {
margin-left: -2px;
}
}

.scrollable-list {
margin-top: 5px;

&.list-group {
border-top: 0;
}
}
}
}

Expand Up @@ -135,8 +135,8 @@ exports[`BreadcrumbSwitcherPopover render resources list 1`] = `
disablePrevious={true}
messages={
Object {
"nextPage": "Next",
"previousPage": "Previous",
"nextPage": "",
"previousPage": "",
}
}
onNextPage={[Function]}
Expand Down Expand Up @@ -258,8 +258,8 @@ exports[`BreadcrumbSwitcherPopover render resources list with a search query 1`]
disablePrevious={true}
messages={
Object {
"nextPage": "Next",
"previousPage": "Previous",
"nextPage": "",
"previousPage": "",
}
}
onNextPage={[Function]}
Expand Down Expand Up @@ -381,8 +381,8 @@ exports[`BreadcrumbSwitcherPopover render resources list with pagination 1`] = `
disablePrevious={false}
messages={
Object {
"nextPage": "Next",
"previousPage": "Previous",
"nextPage": "",
"previousPage": "",
}
}
onNextPage={[Function]}
Expand Down
Expand Up @@ -2,7 +2,7 @@

.input-search {
position: relative;
left: 5px;
left: 20px;

input {
text-indent: 25px;
Expand Down