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

Code cleanup #161

Merged
merged 5 commits into from
Sep 29, 2024
Merged

Code cleanup #161

merged 5 commits into from
Sep 29, 2024

Conversation

fregante
Copy link
Collaborator

No description provided.

@fregante fregante marked this pull request as draft September 27, 2024 09:07
export let optionsUrl;
export let icons; // Optional
export let icons = undefined; // eslint-disable-line no-undef-init -- Optional svelte property
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

eslint autofixed this away from #160

@@ -0,0 +1,20 @@
export default function pickBestIcon(icons, size = 16) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had to rewrite this function because I had messed up and never checked. Tests FTW

}

// If it's not available (e.g. requested 32, available only 16), get the largest one
return smallestToLargest.at(-1).url;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The main change is that it will now never pick the fallback if any icons exist.

@fregante fregante marked this pull request as ready for review September 27, 2024 09:11
@fregante fregante merged commit 0074268 into main Sep 29, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant