GithubHelp home page GithubHelp logo

components's People

Contributors

jxnblk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar

components's Issues

Is / as have not defined propType which throws error with storybook-info

Hello everyone.

Im trying to build component library using rebass grid, styled-components, styled system and rebass/components.

I created a Text component using rebassjs/components as in here

`
/**
*

  • Text

*/

import system from '@rebass/components';
const Text = system(
{
as: 'p',
},
'space',
'width',
'textAlign',
'fontFamily',
'lineHeight',
'fontWeight',
'letterSpacing',
);
Text.displayName = 'Text';

export default Text;
`

When im adding into into storybook, with @storybook/addon-info, it throws an error, when the addon is trying to generate the props table.

checkPropTypes.js:19 Warning: Failed prop type: Invalid prop type of type object supplied to PropTable, expected function.
in PropTable
in Unknown (created by Story)
in div (created by Story)
in div (created by Story)
in div (created by Story)
in div (created by Story)
in div (created by Story)
in ThemeProvider (created by Story)
in Story
in ThemeProvider

I assume its due to the fact it can not find the propType for 'is' property, it shows it as unknown.

Is there a way to fix this in code, or it will require change to the rebassjs/components?

Getting render errors when trying this library

I'm getting a slew of styled-component errors when I try to render a component created the the system-component helper.

The top level error is:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Here are the rest of the errors:
image

I should also mention that i I create a styled component from scratch like so:

const Text = styled.div`
  color: ${props => props.theme.colors.silver};
`

it works just fine.

Here is the output when I render the component created from system-component console.lo('ext', <Text />)

image

Any tips would be greatly appreciate. Thanks for a great library!

Using a component with `is` results in a react warning

Currently when doing something like this where Link is a system component,

import { Link as AppLink } from '@reach/router'

<Link is={AppLink}>Some Link</Link>

it will show this warning

Received a `object` for a string attribute `is`. If this is expected, cast the value to a string.

Is this the expected behaviour?

Example of most basic usage, unable to apply styles

Hey,

I was wondering if anyone could help me understand why this super basic example is not working?

Code Sandbox link: https://codesandbox.io/s/mjvrlvvw4y

import system from "@rebass/components";

const Title = system({
  p: 5
});

function App() {
  return <Title>Hello, world!</Title>;
}

I am aware I can pass extra arguments, and indeed if I pass space as a second argument, it works. Is this by design?

React Native

I noticed that setting 'is' to View worked for me, but I never saw the docs saying anything about it, or about passing elements directly into 'is', rather than strings. FYI

Stable release?

Thanks for building @rebass/components, it has cleaned up a lot of code in a project my team is working on.

My only concern is that the current status is pre-release, with no roadmap or indication on the stability of the code's current state. I was curious is there is any insight/discussion on what will make this a stable release, and when that can be expected.

System components removal from Rebass

@jxnblk I'm currently building a component library at my company, after I was massively inspired by your work. Naturally I was using system-components with each of my components as a base, since it provided great utility functions. I noticed you moved system-components out to its own project repo, and removed the use of it from Rebass.

Would you still recommend the use of system-components to users building component libraries? Or was the use case for it in rebass just not worth it? Also, Could one use the 8 Rebass primitives as Bases in a component library, and then extend them with the functionality that system-components provide?

Anyways, love your work as always!

Wrong inheritance from rebass component

Hello,

I'm migrating from rebass@2 and styled-system to rebass@3 and rebass/components.

Because rebass/components implementation is not exactly styled-system I found a piece of code that is working fine in the old setup but no under the new stack.

The thing that I'm trying to achieve is pretty simple: Just I want to extend Flex component from rebass to accept more props values:

import system from '@rebass/components'
import { Flex as FlexBase } from 'rebass'

const Flex = system(
  { tag: FlexBase },
  'alignContent',
  'justifyContent',
  'flexDirection',
  'alignItems',
  'flexWrap',
  'maxWidth',
  'lineHeight',
  'borderRadius',
  'boxShadow'
)

Flex.displayName = 'Flex'

export default Flex

The thing I noted is the new component is not inheritance the base (Flex) component properly.

Specifically, the new component doesn't have the inheritance of the componentStyle from the base component.

screenshot 2018-11-25 at 13 30 53

I understand this could be an speficif internal related with styled-components, but actually I have no idea.

This is happening because under @rebass/components the implementation to determinate the tag component is using forwardRef and it's a bit smarter than the original implementation that is using a simple styled-components constructor.

Although looks it's not working properly as I expected, I suppose the approach of use this new implementation have advantages in terms of perfomance, so I'm interested why this change.

Feel it's related with styled-components/styled-components#1209

Using `is` to extend a component uses 100% CPU and crashes the browser tab

I upgraded to rebass 2.3.4, and moved from using system-components to @rebass/components and was still using is to extend other components, e.g.:

import system from '@rebass/components'
import { Box } from 'rebass'
export const GrowBox = system(
  {
    is: Box,
    flexGrow: 1
  }
);

screen shot 2018-10-26 at 12 05 44 pm

Changing the is to extend fixes it. ๐Ÿ˜ƒ

Took a little while to figure out what was causing it, so thought I'd mention it in case anyone else ran into it too. Also wondering if it's worth adding a warning in a future release?


Package versions:

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.