component.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { string } from "vue-types";
  2. import { useCompData } from ".";
  3. import { Text } from "../../..";
  4. import { createUIComp } from "../../../defines/createUIComp";
  5. import { css, cx } from "@linaria/core";
  6. export const Component = createUIComp({
  7. props: {
  8. compId: string().isRequired,
  9. },
  10. setup(props) {
  11. const { children } = useCompData(props.compId);
  12. return () => (
  13. <div class="flex items-center justify-center px-0.1rem">
  14. <div class={cx(border, "left w-1rem text-0.34rem text-right")}>
  15. &frasl; &frasl;
  16. </div>
  17. <Text.Component
  18. class="px-0.5rem max-w-4.8rem"
  19. compId={children.title?.id}
  20. />
  21. <div class={cx(border, "right w-1rem text-0.34rem")}>
  22. &frasl; &frasl;
  23. </div>
  24. </div>
  25. );
  26. },
  27. });
  28. const border = css`
  29. position: relative;
  30. color: #999;
  31. &::after {
  32. content: "";
  33. position: absolute;
  34. bottom: 50%;
  35. width: 100%;
  36. height: 1px;
  37. background-color: currentColor;
  38. }
  39. &.left {
  40. &::after {
  41. left: 0.06rem;
  42. }
  43. }
  44. &.right {
  45. &::after {
  46. left: -0.06rem;
  47. }
  48. }
  49. `;