reflex icon indicating copy to clipboard operation
reflex copied to clipboard

Update CodeBlock class to accept rx.color in custom_style

Open khhan0130 opened this issue 1 year ago β€’ 2 comments

Type of change

  • [X] Bug fix (non-breaking change which fixes an issue)

Changes the types accepted in the CodeBlock class (components/datadisplay/code.py) custom_style from Union[str, Var] to Union[str, Var, Color]. Fixes the issue where rx.color does not work in the markdown component map, at least for code blocks.

Includes one test under /tests/components/core/test_colors.py. pytest passes the new tests, and there is one failure, although this was the case even before I made any changes. A couple other changes were made with poetry run black reflex tests, which should not have any functional effect.

Fixes #2957 (hopefully)

khhan0130 avatar Apr 26 '24 05:04 khhan0130

As of a recent PR, we're not using black anymore (aside for .pyi files, but they're not edited manually anyway), but ruff-format instead.

Run pre-commit on your PR to make it pass the tests.

Lendemor avatar Apr 26 '24 17:04 Lendemor

Hopefully I've fixed the issue. Let me know if there's still any problems.

Edit: Made a few more changes. Now, hopefully I've actually fixed the issues...

khhan0130 avatar Apr 26 '24 18:04 khhan0130

The pre-commit check seems to be failing here, but it works on my end. Any ideas? image

khhan0130 avatar Apr 30 '24 04:04 khhan0130

@khhan0130 I think you just need to run poetry run ruff --fix reflex. I tried to push to your PR but I got permission issues

picklelo avatar May 01 '24 16:05 picklelo

@picklelo Thanks. Think the issue was that I didn't update reflex with poetry install, so ruff was getting a TOML parse error. Think it should be fixed now.

khhan0130 avatar May 01 '24 18:05 khhan0130