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

Widen arrow underneath popups #30

Open
ErikBoesen opened this issue Apr 13, 2020 · 3 comments
Open

Widen arrow underneath popups #30

ErikBoesen opened this issue Apr 13, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@ErikBoesen
Copy link
Member

Would be nice if it matched the width of the popup itself.

@JonathanOppenheimer
Copy link
Member

Occurs when there's more than 1 column. Examples below

Correct width:
c7
Insuffcient width:
c6

@JonathanOppenheimer JonathanOppenheimer added the enhancement New feature or request label Mar 16, 2021
@JonathanOppenheimer
Copy link
Member

Just looked into this and it should be pretty simple -- Erik already set up a variable for the number of columns on line 255 of scripts.js for use in popup.css:

info.style.setProperty('--num-columns', Math.ceil(studentsList.children.length / 5));

In the same vein that --num-columns is used on lines 91-98 (right below) to set the popup content width, it should be super easily done for the tip widths.

.popup-content .institution-container {
margin: 0px auto;
max-width: calc(200px * var(--num-columns));
}
.popup-content {
width: calc(200px * var(--num-columns));
box-sizing: content-box;
}

I set it up using the border.left and the border.right (currently lines 28 and 29) which has a default value of 105px. Multiplying 105px by the number of columns adjusts the tip to be the right size. For example, if we hard set a column number of 2 with the code below, the following is observed:

--border-width: calc(105px * 2);
border-left: var(--border-width) solid transparent;
border-right: var(--border-width) solid transparent;

image

Works as intended. However when replacing the hardcoded 2 with the actual variable with the code below, the arrow just dips out.

--border-width: calc(105px * var(--num-columns));
border-left: var(--border-width) solid transparent;
border-right: var(--border-width) solid transparent;
image

I've confirmed that this variable actually does work by logging it and obviously the --num-columns variable works in it's other instances.
image
image

I've messed extensively with syntax and other stuff tryna get it to work - I would like the half an hour I spent on a triangle back.

@AndrewLester
Copy link
Member

I think we tested this on the max column size and it looked a bit odd. We can either close this issue or attempt a fix for Jonathan's problem. The fix is to just put the css variable one element higher in the DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants