-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feature: support Hightlight component #1079
Conversation
738e208
to
558719f
Compare
This code doesn't seem to be working for me can you provide an example? |
It's working fo me. import pynecone as pc
class State(pc.State):
"""The app state."""
text: str = "With the Highlight component, you can spotlight, emphasize and accentuate words."
query=['spotlight', 'emphasize', 'Accentuate']
styles={ 'px': '2', 'py': '1', 'rounded': 'full', 'bg': 'teal.100' }
def index():
"""The main view."""
return pc.heading(
pc.highlight(State.text, query=State.query, styles=State.styles)
)
app = pc.App(state=State)
app.add_page(index)
app.compile() |
I think the |
558719f
to
a12196c
Compare
In chakra highlight does not have default value. |
ef67cb3
to
418a25c
Compare
For this component should we take the stye props and pass them into the style dict similar to how it's done in code block. This would allow code like class State(pc.State):
"""The app state."""
text: str = "With the Highlight component, you can spotlight, emphasize and accentuate words."
query=['spotlight', 'emphasize', 'Accentuate']
styles={ 'px': '2', 'py': '1', 'rounded': 'full', 'bg': 'teal.100' }
def add_query(self, query: str):
"""Add a query to the list of queries."""
self.query.append(query)
def index():
"""The main view."""
return pc.vstack(
pc.input(on_blur=State.add_query),
pc.heading(
pc.highlight(
State.text,
query=State.query,
bg = "green",
color = "red",
px = "2",
py = "1",
rounded = "full",
)
),
) |
418a25c
to
149329e
Compare
It's working right now. |
149329e
to
827dc39
Compare
827dc39
to
91efaec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features:
After these steps, you're ready to open a pull request.
support Highlight component.
b. Describe your changes.
support Highlight component and you have to notice styles and style is different prop. Highlight uses styles.
close #1048