Coder Social home page Coder Social logo

elemental-design / elemental-react Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 0.0 2.73 MB

Build UI components once, render to any platform: web, React Native and Sketch.

JavaScript 8.13% TypeScript 91.87%
cross-platform react react-native react-primitives react-sketchapp sketch-app styled-system ui-components ui-design

elemental-react's People

Contributors

dependabot[bot] avatar macintoshhelper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

elemental-react's Issues

Import spec

Export base primitives from the main entrypoint:

import { Box, Text, Button } from 'elemental-react';

Export components from individual files also for better bundle size management e.g.

import BaseButton from 'elemental-react/lib/Button';

export default extend(BaseButton, {
  bg: 'green',
  outlined: true,
  borderColor: 'black',
  '&:hover': {
    bg: 'greens.7'
  },
});

Radix UI and Tailwind CSS

How can we implement cross-platform support together with Radix UI and Tailwind CSS for web? Multilayer abstraction where base components have a styled-components/native implementation and Radix UI implementation? And molecules/components created from these elements can declare what primitive platforms they support?

  • Radix UI
  • Tailwind CSS

Standardise around Yoga CSS and styled-system API

Support 100% of Yoga CSS API.

Support styled-system aliases with proposed system:

const useStyles = (styles) => {
  return useMemo(() => {
    const parsedStyles = parseStyles(styles);
    return StyleSheet.create(parsedStyles);
  }, styles);
};

const filterStyles = props => props.filter(prop => ['backgroundColor, 'color, 'fontSize'].includes(prop);
const filterProps = props => props.filter(prop => !['backgroundColor, 'color, 'fontSize'].includes(prop);

const Box = (props) => {
  const styles = filterStyles(props);
  const style = useStyles(styles);

  return <View style={style} {...filterProps(props)} />;
};
const mapping = {
  bg: backgroundColor,
  p: padding,
  pt: paddingTop,
  pb: paddingBottom,
  pl: paddingLeft,
  pr: paddingRight,
  m: margin,
  mt: marginTop,
  mb: marginBottom
// ...
};

const parseStylesheet = (styles) => {
  const parsedStyles = {};

  Object.entries(styles).forEach(([att, val]) => {
    if (mapping[att]) {
      parsedStyles[mapping[att]] = val;
    }
  });

  return parsedStyles;
}

Infer lineHeight prop from resolved style font size

If someone isn't passing a fontSize prop, but a style object instead, then we should extract the font size with StyleSheet.resolve() and use it as a default lineHeight value, potentially adding a configurable multiplier and grid rounding number in the theme object.

Elemental React | Abstract [WIP]

What is Elemental React?

Prototype rapidly first, polish quickly after.

Elemental React is a new way of building React apps. Build your UI once, render it to any platform with our base elements.

elemental-react provides you base elements, which can be used to build a prototype of your app or design.

e.g. We provide you a base <Button> which can be extended by you to <PrimaryButton>, <SecondaryButton>, <FlatButton>, <OutlinedButton>, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.