logo.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. """A Reflex logo component."""
  2. from typing import Union
  3. import reflex as rx
  4. def svg_logo(
  5. color: Union[str, rx.Var[str]] = rx.color_mode_cond("#110F1F", "white"),
  6. **props,
  7. ):
  8. """A Reflex logo SVG.
  9. Args:
  10. color: The color of the logo.
  11. props: Extra props to pass to the svg component.
  12. Returns:
  13. The Reflex logo SVG.
  14. """
  15. def logo_path(d: str):
  16. return rx.el.svg.path(d=d)
  17. paths = [
  18. "M0 11.5999V0.399902H8.96V4.8799H6.72V2.6399H2.24V4.8799H6.72V7.1199H2.24V11.5999H0ZM6.72 11.5999V7.1199H8.96V11.5999H6.72Z",
  19. "M11.2 11.5999V0.399902H17.92V2.6399H13.44V4.8799H17.92V7.1199H13.44V9.3599H17.92V11.5999H11.2Z",
  20. "M20.16 11.5999V0.399902H26.88V2.6399H22.4V4.8799H26.88V7.1199H22.4V11.5999H20.16Z",
  21. "M29.12 11.5999V0.399902H31.36V9.3599H35.84V11.5999H29.12Z",
  22. "M38.08 11.5999V0.399902H44.8V2.6399H40.32V4.8799H44.8V7.1199H40.32V9.3599H44.8V11.5999H38.08Z",
  23. "M47.04 4.8799V0.399902H49.28V4.8799H47.04ZM53.76 4.8799V0.399902H56V4.8799H53.76ZM49.28 7.1199V4.8799H53.76V7.1199H49.28ZM47.04 11.5999V7.1199H49.28V11.5999H47.04ZM53.76 11.5999V7.1199H56V11.5999H53.76Z",
  24. ]
  25. return rx.el.svg(
  26. *[logo_path(d) for d in paths],
  27. rx.el.title("Reflex"),
  28. aria_label="Reflex",
  29. role="img",
  30. width=props.pop("width", "56"),
  31. height=props.pop("height", "12"),
  32. fill=color,
  33. xmlns="http://www.w3.org/2000/svg",
  34. **props,
  35. )
  36. def logo(**props):
  37. """A Reflex logo.
  38. Args:
  39. **props: The props to pass to the component.
  40. Returns:
  41. The logo component.
  42. """
  43. return rx.center(
  44. rx.link(
  45. rx.hstack(
  46. "Built with ",
  47. svg_logo(),
  48. text_align="center",
  49. align="center",
  50. padding="1em",
  51. ),
  52. href="https://reflex.dev",
  53. size="3",
  54. ),
  55. width=props.pop("width", "100%"),
  56. **props,
  57. )