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

Popup and tooltip: dimensions in rem and bug fix of arrow placement #23820

Closed
wants to merge 11 commits into from

Conversation

NielsHolt
Copy link

@NielsHolt NielsHolt commented Sep 3, 2017

Hi
This PR will change the dimensions of popover and tooltip from px to rem AND fix a bug in the way the arrow of popover and tooltips are placed. The current placement of the arrow is only centered on the element when border-width and arrow-width are default values. This PR will allow both border-width and arrow-width to be changed
It need to be merged/integrated with #23763
Could solve #23793 and issues in #23468
Setting $border-width: 20px; $popover-border-width:10px; in Bootstrap 4-beta would give
bootstrap-popover-4-beta
In this PR (with $popover-arrow-width: 1rem;) it would be
bootstrap-popover-nielsholt

Allows for arrow-width in rem
Allows for arrow-width in rem
… popup-in-rem

# Conflicts:
#	scss/_variables.scss
Fix error on arrow margin to center arrow on element
$popover-arrow-width: 10px !default;
$popover-arrow-height: 5px !default;
$popover-arrow-width: .8rem !default;
$popover-arrow-height: .4rem !default;

Choose a reason for hiding this comment

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

Line contains trailing whitespace


$popover-arrow-width: 10px !default;
$popover-arrow-height: 5px !default;
$popover-arrow-width: .8rem !default;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

$popover-body-padding-y: 9px !default;
$popover-body-padding-x: 14px !default;
$popover-body-padding-y: 0.5625rem !default;
$popover-body-padding-x: 0.875rem !default;

Choose a reason for hiding this comment

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

0.875 should be written without a leading zero as .875


$popover-body-color: $body-color !default;
$popover-body-padding-y: 9px !default;
$popover-body-padding-x: 14px !default;
$popover-body-padding-y: 0.5625rem !default;

Choose a reason for hiding this comment

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

0.5625 should be written without a leading zero as .5625

$popover-header-padding-y: 8px !default;
$popover-header-padding-x: 14px !default;
$popover-header-padding-y: 0.5rem !default;
$popover-header-padding-x: 0.875rem !default;

Choose a reason for hiding this comment

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

0.875 should be written without a leading zero as .875

@@ -608,40 +608,39 @@ $tooltip-max-width: 200px !default;
$tooltip-color: $white !default;
$tooltip-bg: $black !default;
$tooltip-opacity: .9 !default;
$tooltip-padding-y: 3px !default;
$tooltip-padding-x: 8px !default;
$tooltip-padding-y: 0.1875rem !default;

Choose a reason for hiding this comment

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

0.1875 should be written without a leading zero as .1875

@@ -68,7 +71,7 @@

.arrow::before {
right: 0;
margin-top: -($tooltip-arrow-width - 2);
margin-top: $tooltip-arrow-margin;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

@@ -54,7 +57,7 @@
}

.arrow::before {
margin-left: -($tooltip-arrow-width - 2);
margin-left: $tooltip-arrow-margin;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

@@ -41,7 +44,7 @@
}

.arrow::before {
margin-top: -($tooltip-arrow-width - 2);
margin-top: $tooltip-arrow-margin;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

@@ -28,7 +31,7 @@
}

.arrow::before {
margin-left: -($tooltip-arrow-width - 2);
margin-left: $tooltip-arrow-margin;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

@@ -21,14 +22,16 @@
height: $tooltip-arrow-height;
}

$tooltip-arrow-margin: -$tooltip-arrow-width/2;

Choose a reason for hiding this comment

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

$tooltip-arrow-width/2 should be written with a single space on each side of the operator: $tooltip-arrow-width / 2

border-bottom-color: $popover-arrow-outer-color;
}

.arrow::after {
top: -($popover-arrow-outer-width - 1);
top: $popover-arrow-after-coor;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

@@ -106,17 +109,17 @@

.arrow::before,
.arrow::after {
margin-left: -($popover-arrow-width - 3);
margin-left: $popover-arrow-margin;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

border-top-color: $popover-arrow-outer-color;
}

.arrow::after {
bottom: -($popover-arrow-outer-width - 1);
margin-left: -($popover-arrow-outer-width - 5);
bottom: $popover-arrow-after-coor;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

}

.arrow::before {
bottom: -$popover-arrow-outer-width;
margin-left: -($popover-arrow-outer-width - 5);
bottom: $popover-arrow-before-coor;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

@@ -39,17 +43,17 @@

.arrow::before {
content: "";
border-width: $popover-arrow-outer-width;
border-width: $popover-arrow-width;

Choose a reason for hiding this comment

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

Line contains trailing whitespace

}

$popover-arrow-margin: -$popover-arrow-width/2;
$popover-arrow-before-coor: calc(-#{$popover-arrow-width} - #{$popover-border-width});
$popover-arrow-after-coor : -$popover-arrow-width;

Choose a reason for hiding this comment

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

Variable names should be followed immediately by a colon

}

$popover-arrow-margin: -$popover-arrow-width/2;

Choose a reason for hiding this comment

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

Line contains trailing whitespace
$popover-arrow-width/2 should be written with a single space on each side of the operator: $popover-arrow-width / 2

width: $popover-arrow-width;
height: $popover-arrow-height;
width: calc(2*#{$popover-border-width} + #{$popover-arrow-width});
height: calc(2*#{$popover-border-width} + #{$popover-arrow-height});

Choose a reason for hiding this comment

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

Line contains trailing whitespace

@@ -25,10 +25,14 @@
.arrow {
position: absolute;
display: block;
width: $popover-arrow-width;
height: $popover-arrow-height;
width: calc(2*#{$popover-border-width} + #{$popover-arrow-width});

Choose a reason for hiding this comment

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

Line contains trailing whitespace

@Johann-S
Copy link
Member

Johann-S commented Sep 4, 2017

is it possible to have a live example on a Codepen ?

@NielsHolt
Copy link
Author

@Johann-S - I put some images in my original comment. I haven't used CodePen before but I give it a try (but it may take a while)

@alecpl alecpl mentioned this pull request Sep 7, 2017
@NielsHolt
Copy link
Author

NielsHolt commented Sep 12, 2017

Hi @Johann-S
I have made a Codepen here
It seems that floating-ui/floating-ui#417 and #23846 solves some of the issues, but I don't have the full overview

@NielsHolt NielsHolt closed this Sep 12, 2017
@NielsHolt NielsHolt reopened this Sep 12, 2017
@NielsHolt
Copy link
Author

Sorry - closed by mistake

@wojtask9
Copy link
Contributor

@NielsHolt
I created PR #23936 (based on your) but should fix some other issues.
Can you check if my PR fix also your issues?

@NielsHolt
Copy link
Author

Ups - was closed by mistake. Reopened with updated demo

@mdo
Copy link
Member

mdo commented Oct 2, 2017

Not a fan of this approach, thanks though!

@mdo mdo closed this Oct 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants