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

Wrapping extra components inside of the Context Menu Component #4831

Merged
merged 5 commits into from
Feb 19, 2025

Conversation

slackroo
Copy link
Contributor

@slackroo slackroo commented Feb 17, 2025

Wrapping extra components inside of the Context Menu Component (partial fix for #4262) label, group, radio, radio_group

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

After these steps, you're ready to open a pull request.

a. Give a descriptive title to your PR.

b. Describe your changes.

In context_menu.py, I added a new ContextMenuLabel, ContextMenuGroup, ContextMenuRadioItem, ContextMenuRadioGroup class and initialized them . Users can now use the checkbox like this:
Screenshot 2025-02-17 at 6 05 49 PM

the component is

def test_contex_menu() -> rx.Component:
    return rx.context_menu.root(
        rx.context_menu.trigger(
            rx.button("Right click me"),
        ),
        rx.context_menu.content(
            rx.context_menu.item("Edit", shortcut="⌘ E"),
            rx.context_menu.item("Duplicate", shortcut="⌘ D"),
            rx.context_menu.separator(),
            rx.context_menu.item("Archive", shortcut="⌘ N"),
            rx.context_menu.sub(
                rx.context_menu.sub_trigger("More"),
                rx.context_menu.sub_content(
                    rx.context_menu.item("Move to project…"),
                    rx.context_menu.item("Move to folder…"),
                    rx.context_menu.separator(),
                    rx.context_menu.item("Advanced options…"),
                    rx.context_menu.radio_group(
                        rx.radio(['Radio item "A"'])
                    ),
                ),
            ),
            rx.context_menu.separator(),
            rx.context_menu.label('TestRadioLabel'),
            rx.context_menu.group(
                rx.context_menu.item("grouped item1…"),
                rx.context_menu.item("grouped item2…"),
            ),
            rx.context_menu.radio_group(
                rx.radio_group(
                    [
                        'Radio Group item "A"',
                        'Radio Group item "B"',
                    ],
                    direction='column'
                )
            ),
            rx.context_menu.radio_group(
                rx.context_menu.radio(
                    [
                        'Radio Group item "C"',
                        'Radio Group item "D"',
                    ],
                    direction='column'
                ),
                on_change=State.radio_on_change,
            ),

            rx.context_menu.radio(
                ['Radio item "AB"'],
                disabled=True,
                text_value='ok_text',
                as_child=True
            ),
            rx.context_menu.separator(),
            rx.context_menu.item("Share"),
            rx.context_menu.item("Add to favorites"),
            rx.context_menu.separator(),
            rx.context_menu.item(
                "Delete", shortcut="⌘ ⌫", color="red"
            ),
        ),
    )
c. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such).

This issuse should help tick off the remaining task on issue #4262.

closes #4262

Copy link

codspeed-hq bot commented Feb 17, 2025

CodSpeed Performance Report

Merging #4831 will not alter performance

Comparing slackroo:slackroo/good-first-issue-#4262 (e9ccbaa) with main (0a33cc3)

Summary

✅ 12 untouched benchmarks

@slackroo slackroo requested a review from adhami3310 February 19, 2025 09:28
@adhami3310 adhami3310 merged commit 405872a into reflex-dev:main Feb 19, 2025
43 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.

Wrapping some extra components inside of the Context Menu Component
2 participants