How to use the reakit-system.createComponent function in reakit-system

To help you get started, we’ve selected a few reakit-system examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reakit / reakit / packages / website / src / components / Anchor.ts View on Github external
useProps(_, htmlProps) {
    const color = usePalette("link");
    const anchor = css`
      color: ${color};
      font-weight: 500;
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    `;
    return { ...htmlProps, className: cx(anchor, htmlProps.className) };
  }
});

const Anchor = createComponent({
  as: "a",
  useHook: useAnchor,

  useCreateElement(type, { href, ...props }, children) {
    if (href && /^\/(?!\/)/.test(href)) {
      return useCreateElement(Link, { to: href, ...props }, children);
    }
    return useCreateElement(type, { href, ...props }, children);
  }
});

export default Anchor;
github reakit / reakit / packages / website / src / components / List.ts View on Github external
}
          strong ~ code {
            color: indianred;
          }
          margin-bottom: 1.5em;
          p {
            margin: 0.5em 0 0;
          }
        }
      }
    `;
    return { ...htmlProps, className: cx(list, htmlProps.className) };
  }
});

const List = createComponent({
  as: "ul",
  useHook: useList
});

export default List;
github reakit / reakit / packages / website / src / components / SkipToContent.ts View on Github external
margin: 1em;
        text-align: center;
        z-index: 999;
      }
    `;
    return {
      tabIndex: 0,
      children: "Skip to main content",
      href: "#main",
      ...htmlProps,
      className: cx(skipToContent, htmlProps.className)
    };
  }
});

const SkipToContent = createComponent({
  as: "a",
  useHook: useSkipToContent
});

export default SkipToContent;
github reakit / reakit / packages / website / src / components / Blockquote.tsx View on Github external
...htmlProps,
        children: isExperimental ? (
          <>
            
            <div>{htmlProps.children}</div>
          
        ) : (
          htmlProps.children
        ),
        className: cx(blockquote, htmlProps.className)
      };
    }
  }
);

const Blockquote = createComponent({
  as: "blockquote",
  useHook: useBlockquote
});

export default Blockquote;
github reakit / reakit / packages / website / src / components / Heading.ts View on Github external
@media (max-width: 768px) {
          font-size: 1.25em;
        }
      }
      h4& {
        font-size: 1.25em;
        @media (max-width: 768px) {
          font-size: 1em;
        }
      }
    `;
    return { ...htmlProps, className: cx(heading, htmlProps.className) };
  }
});

const Heading = createComponent({
  as: "h1",
  useHook: useHeading
});

export default Heading;
github reakit / reakit / packages / website / src / components / Paragraph.ts View on Github external
export type ParagraphHTMLProps = BoxHTMLProps;
export type ParagraphProps = ParagraphOptions &amp; ParagraphHTMLProps;

export const useParagraph = createHook({
  name: "Paragraph",
  compose: useBox,

  useProps(_, htmlProps) {
    const paragraph = css`
      line-height: 1.5;
    `;
    return { ...htmlProps, className: cx(paragraph, htmlProps.className) };
  }
});

const Paragraph = createComponent({
  as: "p",
  useHook: useParagraph
});

export default Paragraph;
github reakit / reakit / packages / website / src / components / KeyboardInput.ts View on Github external
border-radius: 0.25em;
      font-family: Consolas, Liberation Mono, Menlo, Courier, monospace;
      background-color: ${backgroundColor};
      padding: 0.3em 0.5em 0.25em;
      border: 1px solid ${borderColor};
      border-width: 1px 1px 2px 1px;
      font-size: 0.875em;
    `;
    return {
      ...htmlProps,
      className: cx(keyboardInput, htmlProps.className)
    };
  }
});

const KeyboardInput = createComponent({
  as: "kbd",
  useHook: useKeyboardInput
});

export default KeyboardInput;
github reakit / reakit / packages / website / src / components / HiddenMediaQuery.ts View on Github external
useProps(options, htmlProps) {
    const hiddenMediaQuery = css`
      @media (${options.query}) {
        display: none !important;
      }
    `;

    return {
      ...htmlProps,
      className: cx(hiddenMediaQuery, htmlProps.className)
    };
  }
});

const HiddenMediaQuery = createComponent({
  as: "div",
  useHook: useHiddenMediaQuery
});

export default HiddenMediaQuery;