Commit 40526400 authored by mgandres's avatar mgandres

Use utils classes to style sidebar

parent 76d9f8da
...@@ -7,6 +7,10 @@ import { JOB_SIDEBAR } from '../../constants'; ...@@ -7,6 +7,10 @@ import { JOB_SIDEBAR } from '../../constants';
import { SIDEBAR_COLLAPSE_BREAKPOINTS } from './constants'; import { SIDEBAR_COLLAPSE_BREAKPOINTS } from './constants';
export default { export default {
styles: {
top: '75px',
width: '290px',
},
name: 'BridgeSidebar', name: 'BridgeSidebar',
i18n: { i18n: {
...JOB_SIDEBAR, ...JOB_SIDEBAR,
...@@ -55,46 +59,40 @@ export default { ...@@ -55,46 +59,40 @@ export default {
</script> </script>
<template> <template>
<aside <aside
class="right-sidebar build-sidebar" class="gl-fixed gl-right-0 gl-px-5 gl-bg-gray-10 gl-h-full gl-border-l-solid gl-border-1 gl-border-gray-100 gl-z-index-200 gl-overflow-hidden"
:style="this.$options.styles"
:class="{ :class="{
'right-sidebar-expanded': isSidebarExpanded, 'gl-display-none': !isSidebarExpanded,
'right-sidebar-collapsed': !isSidebarExpanded,
}" }"
data-offset-top="101"
data-spy="affix"
> >
<div class="sidebar-container"> <div class="gl-py-5 gl-display-flex gl-align-items-center">
<div class="blocks-container"> <tooltip-on-truncate :title="buildName" truncate-target="child"
<div class="gl-py-5 gl-display-flex gl-align-items-center"> ><h4 class="gl-mb-0 gl-mr-2 gl-text-truncate">
<tooltip-on-truncate :title="buildName" truncate-target="child" {{ buildName }}
><h4 class="gl-mb-0 gl-mr-2 gl-text-truncate"> </h4>
{{ buildName }} </tooltip-on-truncate>
</h4> <!-- TODO: implement retry actions -->
</tooltip-on-truncate> <div class="gl-flex-grow-1 gl-flex-shrink-0 gl-text-right">
<!-- TODO: implement retry actions --> <gl-dropdown
<div class="gl-flex-grow-1 gl-flex-shrink-0 gl-text-right"> :text="$options.i18n.retryButton"
<gl-dropdown category="primary"
:text="$options.i18n.retryButton" variant="confirm"
category="primary" right
variant="confirm" size="medium"
right >
size="medium" <gl-dropdown-item>{{ $options.i18n.retryTriggerJob }}</gl-dropdown-item>
> <gl-dropdown-item>{{ $options.i18n.retryDownstreamPipeline }}</gl-dropdown-item>
<gl-dropdown-item>{{ $options.i18n.retryTriggerJob }}</gl-dropdown-item> </gl-dropdown>
<gl-dropdown-item>{{ $options.i18n.retryDownstreamPipeline }}</gl-dropdown-item>
</gl-dropdown>
</div>
<gl-button
:aria-label="$options.i18n.toggleSidebar"
data-testid="sidebar-expansion-toggle"
category="tertiary"
class="gl-md-display-none gl-ml-2"
icon="chevron-double-lg-right"
@click="toggleSidebar"
/>
</div>
<!-- TODO: get job details and show commit block, stage dropdown, jobs list -->
</div> </div>
<gl-button
:aria-label="$options.i18n.toggleSidebar"
data-testid="sidebar-expansion-toggle"
category="tertiary"
class="gl-md-display-none gl-ml-2"
icon="chevron-double-lg-right"
@click="toggleSidebar"
/>
</div> </div>
<!-- TODO: get job details and show commit block, stage dropdown, jobs list -->
</aside> </aside>
</template> </template>
...@@ -40,14 +40,12 @@ describe('Bridge Sidebar', () => { ...@@ -40,14 +40,12 @@ describe('Bridge Sidebar', () => {
}); });
it('toggles expansion on button click', async () => { it('toggles expansion on button click', async () => {
expect(findSidebar().classes()).toContain('right-sidebar-expanded'); expect(findSidebar().classes()).not.toContain('gl-display-none');
expect(findSidebar().classes()).not.toContain('right-sidebar-collapsed');
findToggle().vm.$emit('click'); findToggle().vm.$emit('click');
await nextTick(); await nextTick();
expect(findSidebar().classes()).toContain('right-sidebar-collapsed'); expect(findSidebar().classes()).toContain('gl-display-none');
expect(findSidebar().classes()).not.toContain('right-sidebar-expanded');
}); });
describe('on resize', () => { describe('on resize', () => {
...@@ -62,14 +60,15 @@ describe('Bridge Sidebar', () => { ...@@ -62,14 +60,15 @@ describe('Bridge Sidebar', () => {
'sets isSidebarExpanded to `$isSidebarExpanded` when the breakpoint is "$breakpoint"', 'sets isSidebarExpanded to `$isSidebarExpanded` when the breakpoint is "$breakpoint"',
async ({ breakpoint, isSidebarExpanded }) => { async ({ breakpoint, isSidebarExpanded }) => {
jest.spyOn(GlBreakpointInstance, 'getBreakpointSize').mockReturnValue(breakpoint); jest.spyOn(GlBreakpointInstance, 'getBreakpointSize').mockReturnValue(breakpoint);
const sidebarClass = isSidebarExpanded
? 'right-sidebar-expanded'
: 'right-sidebar-collapsed';
window.dispatchEvent(new Event('resize')); window.dispatchEvent(new Event('resize'));
await nextTick(); await nextTick();
expect(findSidebar().classes()).toContain(sidebarClass); if (isSidebarExpanded) {
expect(findSidebar().classes()).not.toContain('gl-display-none');
} else {
expect(findSidebar().classes()).toContain('gl-display-none');
}
}, },
); );
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment