reflex icon indicating copy to clipboard operation
reflex copied to clipboard

Allowing any case style on all string built ins

Open a13xlol opened this issue 1 year ago β€’ 4 comments

pc.button( pc.icon(tag="MoonIcon"), on_click=pc.toggle_color_mode, ) has same behavior as pc.button( pc.icon(tag="moonicon"), on_click=pc.toggle_color_mode, ) so make it non case sensitive by using .lower() thanks and make sure to have this for any strings related to Pynecone

a13xlol avatar Feb 01 '23 08:02 a13xlol

I'd like to work on this. Just need to know what specific components need to be changed under this

elyanah-aco avatar Feb 01 '23 09:02 elyanah-aco

Hi thanks for taking a look at this, I think a good place to start is the icon component. Feel free to join the discord if you need any help or guidance, or post follow ups here

Alek99 avatar Feb 02 '23 08:02 Alek99

Hi thanks for taking a look at this, I think a good place to start is the icon component. Feel free to join the discord if you need any help or guidance, or post follow ups here

^ yea icon components and other places in code base where strings are used I feel non case sensitive should be used

a13xlol avatar Feb 04 '23 14:02 a13xlol

This was a little more complicated to solve than I actually thought. The below code addition for icon.py works in testing but doesn't feel rigorous enough. What do you think?

 if "tag" not in props.keys():
            raise AttributeError("Missing 'tag' keyword-argument for Icon")
        else:
            tag_keywords = [
                "add", "allowed", "arrow", "back", "circle", "clock", "close", "down", "forward",
                "handle", "icon", "left", "link", "off", "outline", "right", "sign", "two", "up"
            ]
            props['tag'] = props['tag'].title()
            for keyword in tag_keywords:
                props['tag'] = re.sub(keyword, keyword.title(), props['tag'])

elyanah-aco avatar Feb 06 '23 14:02 elyanah-aco

Seems fixed via #553 unless there are other areas that are unaddressed.

rx.icon(tag="RePeaT"),

is rendering correctly

masenf avatar Jul 07 '23 00:07 masenf