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 star rating component #253

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

GabrielVidal1
Copy link
Contributor

A simple readonly star rating with custom color

Capture d’écran 2024-10-05 à 19 19 44

Copy link

netlify bot commented Oct 5, 2024

Deploy Preview for streamlit-extras-docs ready!

Name Link
🔨 Latest commit 89cadb3
🔍 Latest deploy log https://app.netlify.com/sites/streamlit-extras-docs/deploys/6758bd7cc341790008fd5d5e
😎 Deploy Preview https://deploy-preview-253--streamlit-extras-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@arnaudmiribel
Copy link
Owner

Hey @GabrielVidal1, thank you for this contribution! Do you mind pulling from main again? There has been changes in our CI that must be reflected in this branch.

from streamlit.components.v1 import html


def star_rating(rating: float, color="#FFD700"):
Copy link
Owner

@arnaudmiribel arnaudmiribel Oct 7, 2024

Choose a reason for hiding this comment

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

color can be type-hinted as str:

Suggested change
def star_rating(rating: float, color="#FFD700"):
def star_rating(rating: float, color: str = "#FFD700"):

@GabrielVidal1
Copy link
Contributor Author

I did the fixes and rebased on main!

@arnaudmiribel
Copy link
Owner

arnaudmiribel commented Oct 21, 2024

@GabrielVidal1 sorry I was out for a bit. I didn't catch it last time, but you're missing the @extra decorator for the star_rating function. It's mandatory to register and expose the useful functions that are then shown in the documentation for instance. Usage is as follow:

from .. import extra

@extra
def star_rating(...):
    # original implementation

Example in code.

Copy link
Owner

@arnaudmiribel arnaudmiribel left a comment

Choose a reason for hiding this comment

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

See comment above ^, missing @extra

@arnaudmiribel arnaudmiribel merged commit afb18dc into arnaudmiribel:main Dec 10, 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.

2 participants