Archived
1
0
Fork 0
Modular component framework for React that splits layout and styles
This repository has been archived on 2022-12-12. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • TypeScript 99.9%
  • MDX 0.1%
Find a file
2022-11-11 16:13:21 +03:00
docs Rename base folders 2022-01-22 23:17:59 +03:00
lib Prevent FileList cloning 2022-11-11 16:13:00 +03:00
.editorconfig 0.1.0 2021-06-02 16:28:50 +03:00
.eslintrc Get rid of style props 2021-08-23 01:34:07 +03:00
.gitignore Switch to tsup, bump deps 2022-01-22 23:10:04 +03:00
.prettierrc 0.1.0 2021-06-02 16:28:50 +03:00
.releaserc Switch to tsup, bump deps 2022-01-22 23:10:04 +03:00
LICENSE 0.1.0 2021-06-02 16:28:50 +03:00
package-lock.json 0.37.9 2022-11-11 16:13:21 +03:00
package.json 0.37.9 2022-11-11 16:13:21 +03:00
README.md Update README 2021-10-06 16:57:45 +03:00
tsconfig.json Switch to tsup, bump deps 2022-01-22 23:10:04 +03:00

Restyler 🎨

Restyler is a general purpose design system for React. It was designed to be simple and responsive while preserving flexibility and ease of code writing. Restyler is distributed via the npm package and its code is hosted on GitHub. We also host storybook that contains various component demos and documentation.

Installation

Installation is easy and common:

npm install --save restyler

After Restyler is installed, one needs to provide it the style adapter. The following code sample demonstrates emotion integration:

const styledAdapter = (tag, fn) => styled(tag)(fn);

export default App = () => {
  return <SystemContainer styled={styledAdapter}>{/* ... */}</SystemContainer>;
};

If you'd like to use, for example, theme-ui that doesn't provide a styled function by itself, you can do the following:

const styledAdapter = (Tag, fn) =>
  forwardRef((props, ref) => {
    const { theme, kind, ...rest } = props;
    const validProps = Object.keys(rest).reduce(
      (p, k) => (isPropValid(k) ? { ...p, [k]: rest[k] } : p),
      { sx: fn(props) }
    );
    return <Tag ref={ref} {...validProps} />;
  });

export default App = () => {
  return <SystemContainer styled={styledAdapter}>{/* ... */}</SystemContainer>;
};