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

Aside: Support custom icons #2261

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shubham-padia
Copy link

Description

This PR adds the ability to pass icon attribute to the Aside component. This icon attribute can be any icon supported by starlight by default.

Copy link

changeset-bot bot commented Aug 27, 2024

⚠️ No Changeset found

Latest commit: da7a1b7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added 📚 docs Documentation website changes 🌟 core Changes to Starlight’s main package labels Aug 27, 2024
Copy link

netlify bot commented Aug 27, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit da7a1b7
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/66fb880b13408c0008fbd967
😎 Deploy Preview https://deploy-preview-2261--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@astrobot-houston
Copy link
Collaborator

Hello! Thank you for opening your first PR to Starlight! ✨

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🤩

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@astrobot-houston
Copy link
Collaborator

astrobot-houston commented Aug 27, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en components/asides.mdx Source changed, localizations will be marked as outdated.
en guides/authoring-content.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Astro helps you build faster websites with [“Islands Architecture”](https://docs.astro.build/en/concepts/islands/).
:::
```

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 whether this should have a different header of its own or should we just specify it along with the custom aside title markdown

iconPath = [s('path', properties)];
}
}

Copy link
Author

Choose a reason for hiding this comment

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

This feels a bit ugly-ish to me, any pointers to improve this would be welcome!

const iconName = attributes['icon'] as keyof typeof Icons;
if (!Object.keys(Icons).includes(iconName)) {
throw new AstroError("Icon name should be part of Starlight's icon list.");
}
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 put a placeholder error for now, please feel free to suggest another error message that might follow starlight's guidelines.

@shubham-padia shubham-padia marked this pull request as ready for review August 27, 2024 12:05
@shubham-padia shubham-padia changed the title Draft: Support custom icons Support custom icons Aug 27, 2024
@shubham-padia shubham-padia changed the title Support custom icons Aside: Support custom icons Aug 27, 2024
Only built-icons will be supported for now. This commit does not
add support for the `:::` markdown shorthand for defining an aside,
that will be done in the next commit.
@shubham-padia
Copy link
Author

Bumping this up for review, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 core Changes to Starlight’s main package 📚 docs Documentation website changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants