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

fix(select): change arrow trigger position to absolute #60

Merged
merged 7 commits into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ $autocompleteColor: $sbbColorGrey;
$autocompleteInputActiveBorderBottomColor: $sbbColorCloud;

@if $sbbBusiness {
$autocompleteBorder: 1px solid $sbbColorGrey;
$autocompleteBorder: 1px solid $sbbColorGranite;
$autocompleteShadow: 0 4px 0 rgba(0, 0, 0, 0.15);
$autocompleteShadowReverse: 0 -4px 0 rgba(0, 0, 0, 0.15);
$autocompleteColor: $sbbColorGranite;
}

$autocompleteBorderTopReverse: $autocompleteBorder;
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
@if $selectMode == true {
cursor: default;
color: $sbbColorGrey;

@include businessOnly() {
color: $sbbColorGranite;
}
}

&:first-of-type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,7 @@ describe('SelectComponent', () => {
);

const pane = overlayContainerElement.querySelector('.cdk-overlay-pane') as HTMLElement;
expect(pane.style.minWidth).toEqual('330px');
expect(pane.style.minWidth).toEqual('362px');

expect(fixture.componentInstance.select.panelOpen).toBe(true);
expect(overlayContainerElement.textContent).toContain('Steak');
Expand Down Expand Up @@ -2530,7 +2530,7 @@ describe('SelectComponent', () => {
fixture.detectChanges();

const pane = overlayContainerElement.querySelector('.cdk-overlay-pane') as HTMLElement;
expect(pane.style.minWidth).toBe('230px');
expect(pane.style.minWidth).toBe('262px');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
@mixin selectBase {
.sbb-select-trigger {
@include inputfields;
position: relative;
cursor: pointer;
display: flex;
align-items: center;
padding-right: $selectTriggerPaddingRight;
padding-right: toPx($selectTriggerPaddingRight);
Copy link
Collaborator

Choose a reason for hiding this comment

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

padding-right should also be applied for native select.


@include publicOnly() {
@include mq($from: desktop4k) {
padding-right: toPx($selectTriggerPaddingRight * $scalingFactor4k);
}

@include mq($from: desktop5k) {
padding-right: 92px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Usually the desktop5k variant is simply calculated with the $scalingFactor5k. Why is this not the case here?

}
}

&[aria-expanded='true'] {
@include autocompleteInputActive();
Expand All @@ -29,23 +40,45 @@
}

.sbb-select-arrow-wrapper {
@include svgIconColor($sbbColorGrey);
@include absoluteCenterY();
right: toPx($selectArrowRight);

width: toPx($selectArrowWidthHeight);
height: toPx($selectArrowWidthHeight);

@include publicOnly() {
@include svgIconColor($sbbColorGrey);

@include mq($from: desktop4k) {
right: toPx($selectArrowRight * $scalingFactor4k);
width: toPx($selectArrowWidthHeight * $scalingFactor4k);
height: toPx($selectArrowWidthHeight * $scalingFactor4k);
}

@include mq($from: desktop5k) {
right: 28px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question as for padding-right.

width: toPx($selectArrowWidthHeight * $scalingFactor5k);
height: toPx($selectArrowWidthHeight * $scalingFactor5k);
}
}

@include businessOnly() {
@include svgIconColor($sbbColorGranite);
}

&-rotate {
transform-origin: toPx($selectArrowWidthHeight / 2) toPx($selectArrowWidthHeight / 4);

@include publicOnly() {
@include mq($from: desktop4k) {
transform-origin: toPx($selectArrowWidthHeight * $scalingFactor4k / 2) toPx($selectArrowWidthHeight * $scalingFactor4k / 4);
}

@include mq($from: desktop5k) {
transform-origin: toPx($selectArrowWidthHeight * $scalingFactor5k / 2) toPx($selectArrowWidthHeight * $scalingFactor5k / 4);
}
}

transform: rotate(180deg);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

$selectMaxWidth: 480;
$selectArrowWidthHeight: 24;
$selectTriggerPaddingRight: 12px;
$selectArrowRight: 12;
$selectTriggerPaddingRight: 44;

@if $sbbBusiness {
$selectTriggerPaddingRight: 6px;
$selectTriggerPaddingRight: 38;
$selectArrowRight: 6;
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

@include businessOnly() {
border-width: 1px;
color: $sbbColorGranite;

&:focus {
border-color: $sbbColorGranite;
Expand Down