logo.py 1.8 KB

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