logo.py 1.9 KB

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