Skip to content

Commit

Permalink
feat(ui): code review changes EBS-1314
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa.Jalakas committed May 7, 2024
1 parent 7485a08 commit e1bcabb
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 33 deletions.
6 changes: 3 additions & 3 deletions apps/ui-e2e/src/component/steps.component.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ describe('StepsComponent', () => {

it('Renders steps with scrollbar and clicks right button to make left button visible', () => {
cy.loadStory('Angular Steps Steps', 'Default with scroll');
cy.shouldNotExist('button[aria-label="left-scroll-button"]');
cy.get('button[aria-label="right-scroll-button"]').click();
cy.shouldNotExist('button[id="steps-left-scroll-button"]');
cy.get('button[id="steps-right-scroll-button"]').click();

cy.shouldExist('button[aria-label="left-scroll-button"]');
cy.shouldExist('button[id="steps-left-scroll-button"]');
});
});
29 changes: 16 additions & 13 deletions libs/styles/src/lib/scss/components/_steps.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
@include cvi-breakpoint-up(sm) {
#{$base}.is-scrollable & {
display: flex;
padding-left: get-spacing('loksa');
padding-right: get-spacing('loksa');
}

display: grid;
Expand Down Expand Up @@ -105,7 +107,7 @@
@include cvi-breakpoint-up(sm) {
#{$base}.is-scrollable & {
min-width: 247px;
height: 72px;
height: 100%;
}

min-height: 72px;
Expand Down Expand Up @@ -358,7 +360,10 @@
}

#{$base}.is-scrollable {
& #{$base}__scroll-container {
#{$base}__scroll-wrapper {
position: relative;
}
#{$base}__scroll-container {
@include cvi-breakpoint-down(sm) {
display: grid;
}
Expand All @@ -371,22 +376,21 @@
}
}

& #{$base}__scroll-button {
#{$base}__scroll-button {
@include cvi-breakpoint-down(sm) {
display: none;
}
@include cvi-breakpoint-up(sm) {
position: absolute;
height: 72px;
z-index: get-z-index('steps', '__scroll-button');
height: calc(100% - get-spacing('kuressaare'));
width: 32px;
background-color: get-color(black-coral-20);
opacity: 0.8;
display: flex;
line-height: 0;
justify-content: center;
align-items: center;
margin-left: get-spacing('haapsalu');
margin-right: get-spacing('haapsalu');

&--left-scroll {
left: 0;
Expand All @@ -395,13 +399,12 @@
&--right-scroll {
right: 0;
}

&--scroll-icon {
height: get-spacing('haapsalu');
fill: get-color(white);
}
}
}
}
}

#{$base}__scroll-button-icon {
height: get-spacing('haapsalu');
fill: get-color(white);
}
}
}
3 changes: 3 additions & 0 deletions libs/styles/src/lib/scss/settings/variables/_z-indexes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ $cvi-z-indexes: (
'datepicker': (
'__calender',
),
'steps': (
'__scroll-button',
),
);
41 changes: 24 additions & 17 deletions libs/ui/src/lib/steps/steps/steps.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ <h1 *ngIf="title" class="cvi-steps__title" dataAttribute="steps_title">{{ title
</div>
<div class="cvi-steps__inner-wrapper">
<div class="cvi-steps__inner" dataAttribute="steps_container">
<div class="cvi-steps__scroll-wrapper">
<div #stepScrollBar class="cvi-steps__scroll-container">
<div>
<button *ngIf="isScrollable && !leftEdgeVisible"
id="steps-left-scroll-button"
class="cvi-steps__scroll-button cvi-steps__scroll-button--left-scroll"
(click)="onClickScroll(-150)">
<cvi-ng-icon [name]="'arrow_a_left'"
svgClass="cvi-steps__scroll-button-icon">
</cvi-ng-icon>
</button>

<button *ngIf="isScrollable && !rightEdgeVisible"
id="steps-right-scroll-button"
class="cvi-steps__scroll-button cvi-steps__scroll-button--right-scroll"
(click)="onClickScroll(150)">
<cvi-ng-icon [name]="'arrow_a_right'"
svgClass="cvi-steps__scroll-button-icon">
</cvi-ng-icon>
</button>
</div>

<div #leftEdge style="width: 1px"></div>
<ol class="cvi-steps__list">
<li class="cvi-steps__list-item"
Expand Down Expand Up @@ -62,23 +83,9 @@ <h1 *ngIf="title" class="cvi-steps__title" dataAttribute="steps_title">{{ title
</li>
</ol>
<div #rightEdge style="width: 1px"></div>
<button *ngIf="isScrollable && !leftEdgeVisible"
aria-label="left-scroll-button"
class="cvi-steps__scroll-button cvi-steps__scroll-button--left-scroll"
(click)="onClickScroll(-150)">
<cvi-ng-icon [name]="'arrow_a_left'"
svgClass="cvi-steps__scroll-button--scroll-icon">
</cvi-ng-icon>
</button>
<button *ngIf="isScrollable && !rightEdgeVisible"
aria-label="right-scroll-button"
class="cvi-steps__scroll-button cvi-steps__scroll-button--right-scroll"
(click)="onClickScroll(150)">
<cvi-ng-icon [name]="'arrow_a_right'"
svgClass="cvi-steps__scroll-button--scroll-icon">
</cvi-ng-icon>
</button>
</div>
</div>
</div>

<ng-content></ng-content>
<div *ngIf="this.stepChildren.length > 1 && this.currentStepIndex !== null"
class="cvi-steps__directional-buttons"
Expand Down
5 changes: 5 additions & 0 deletions libs/ui/src/lib/steps/steps/steps.component.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ export const DefaultWithSelectedStep = {

export const DefaultWithScroll = {
...Default,
parameters: {
viewport: {
defaultViewport: 'ipad',
},
},
args: {
isScrollable: true,
},
Expand Down

0 comments on commit e1bcabb

Please sign in to comment.