New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Container] Add vertical & horizontal padding, margin, border shortcuts #10
Comments
What did you have in mind for the api of these shortcuts?
I see how you have it in the readme. I may be able to give this a shot today. |
Heyhey @tkh44 cool that you're in! You may also check out React Native's |
Sounds good. I'll take a look at the react native implementation. |
After playing with this a bit tonight I don't think that having the shortcuts explicit (Vertical/Horizontal) would work out too well. Might as well use the css shorthand style. Borders are very tricky because of their complicated nature. I did come up with this https://jsbin.com/jociwi/35/edit?js,console There are several test cases at the bottom. I think you could just merge these produced props with what you have. What do you think? If you like it I can implement this in the lib or we can make changes as necessary. |
Alright I see. Great work you did there. Is React Native actually providing the border shortcut values? I guess perhaps padding and margin are just right (and I really often need exactly vertical/horizontal borders). |
They actually don't provide any of these shortcuts as you have them. They just provide a style hook and check against a given list of proptypes. https://github.com/facebook/react-native/blob/master/Libraries/Components/View/View.js#L265 You can see the prop types here
My suggestion would be to just emulate the react-native api as close as possible while keeping the way this lib has predefined box layouts and just provide shortcuts for the box-model properties as seen here: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model. This would give a standard and intuitive way to communicate that the given component has shortcuts for all of the box model properties and they will be converted to the proper styles. |
@tkh44 I totally forgot to answer 😅 I actually thought they'd provide such style properties, but seems I got that wrong or perhaps saw it somewhere else. I agree with your idea to keep the API as simple and standard as possible. Feel free to push any improvements :) So I guess we can close this one? |
Yeah you can close this one. |
No description provided.
The text was updated successfully, but these errors were encountered: