logo.py 1.8 KB

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