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

Add card height option #3391

Closed

Conversation

DanneelsSophie
Copy link

@DanneelsSophie DanneelsSophie commented Oct 18, 2023

Enregistrement.d.ecran.le.2023-10-18.a.15.40.08.mov

#3387

@vercel
Copy link

vercel bot commented Oct 18, 2023

@DanneelsSophie is attempting to deploy a commit to the github readme stats Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added documentation Improvements or additions to documentation. stats-card Feature, Enhancement, Fixes related to stats the stats card. repo-card Issues related to the pin/repo card. lang-card Issues related to the language card. wakatime-card Issues related to the wakatime card. gist-card labels Oct 18, 2023
@DanneelsSophie
Copy link
Author

DanneelsSophie commented Oct 20, 2023

@rickstaa I know this task assigns airwakz, but I share my pull request, I can close but I'm very curious IF you have time to have your opinions in order to improve. (If you have others tasks, I will be very happy to do it thanks 😊 !

Copy link
Collaborator

@rickstaa rickstaa left a comment

Choose a reason for hiding this comment

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

@DanneelsSophie, first of all, thanks a lot for your contribution! Your pull request will implement a feature many people are waiting for. I like the PR; it is very well-coded, contains tests and is easy to review ❤️‍🔥. I made some comments that need to be solved before I can merge this in the main branch, but I already attached the hacktoberfest-accepted label since you meet all the requirements 🎉!

@@ -77,8 +78,9 @@ const renderGistCard = (gistData, options = {}) => {
.join("");

const lineHeight = descriptionLines > 3 ? 12 : 10;
const height =
(descriptionLines > 1 ? 120 : 110) + descriptionLines * lineHeight;
const height = card_height
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here, it would be nice to implement some logic to ensure that the card height is capped at the minimum height needed to display the contents. If I use height=100 the card is messed up 🤔.

image

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure I push a new version do you want the calcul of the min height or you want a fix height :) ?

Copy link
Collaborator

@rickstaa rickstaa Oct 25, 2023

Choose a reason for hiding this comment

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

@DanneelsSophie, I am afraid the minimum heights need to be calculated dynamically for all cards since the parameters will influence the amount of text on the card. I have not yet investigated the best way to do this.

[![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats)

Anurag's GitHub stats

[![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show=reviews,discussions_started,discussion_answered,prs_merged,prs_merged_percentage)](https://github.com/anuraghazra/github-readme-stats)

Anurag's GitHub stats

Copy link
Author

Choose a reason for hiding this comment

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

Do you review the new version ? ( I must test this the calculated height it is min height). I would like this code structure is well for you !

Copy link
Collaborator

Choose a reason for hiding this comment

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

I will review a new version. However, please bear in mind that calculating the minimum required card might be a challenging task. Also, see @qwerty541's comment at #3159 (comment).

Copy link
Author

Choose a reason for hiding this comment

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

I've kept the calculations from before for the heights. I'll try to read the link you sent me (but it doesn't seem as easy as I thought, I'm on vacation until November 6, butI read the comments :) and your indication to finish this task 😊)

Copy link
Collaborator

@rickstaa rickstaa Nov 1, 2023

Choose a reason for hiding this comment

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

I've kept the calculations from before for the heights. I'll try to read the link you sent me (but it doesn't seem as easy as I thought, I'm on vacation until November 6, butI read the comments :) and your indication to finish this task 😊)

@DanneelsSophie, yeah, implementing this is quite intense. We discussed this at #3159 (comment). I think we will close the card_height pull requests for now and migrate to using a description_lines_count parameter instead. Sorry for the inconvenience.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@qwerty541 feel free to close this when you have a description_lines_count pull request 👍🏻.

@@ -87,8 +88,9 @@ const renderRepoCard = (repo, options = {}) => {
.map((line) => `<tspan dy="1.2em" x="25">${encodeHTML(line)}</tspan>`)
.join("");

const height =
(descriptionLines > 1 ? 120 : 110) + descriptionLines * lineHeight;
const height = card_height
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here we also need a minimum card_height.

45 + (statItems.length + 1) * lheight,
hide_rank ? 0 : statItems.length ? 150 : 180,
);
let height = card_height
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here we also need a minimum card height.

@@ -259,7 +260,9 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {

// Calculate the card height depending on how many items there are
// but if rank circle is visible clamp the minimum height to `150`
let height = Math.max(45 + (filteredLanguages.length + 1) * lheight, 150);
let height = card_height
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code needs a minimum as well.

@@ -805,7 +806,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
customTitle: custom_title,
defaultTitle: i18n.t("langcard.title"),
width,
height,
height: card_height ? card_height : height,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This card also requires the logic for a minimum card height.

Copy link
Collaborator

@qwerty541 qwerty541 left a comment

Choose a reason for hiding this comment

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

Hey, @DanneelsSophie! Thanks for your efforts opening this pull request, i appreciate your considering to contribute! Our team made a decision to resolve this issue #3159 with an alternate solution, so i have to close this pull request in favour of #3453. @rickstaa already added hacktoberfest-accepted label, so i hope it compensates a little your spended time.

@qwerty541 qwerty541 closed this Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation. gist-card hacktoberfest-accepted lang-card Issues related to the language card. repo-card Issues related to the pin/repo card. stats-card Feature, Enhancement, Fixes related to stats the stats card. wakatime-card Issues related to the wakatime card.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants