-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add arrangement solution to the component library #13
Comments
If this is specifically for buttons, why not mimic Bootstrap's "button group" container with our desired styling? |
Noted, but would all these components share the same spacing rules? The buttons work well with that thin gap, whereas forms require more for clarity. |
I personally would want to standardize the list of spacing values as well as the values each component type can use. But since a component can have multiple sizes, we will need to have some if/else checks to ensure the gap is proportionate to the size. What I have in mind at the moment is having a
const ButtonGroup = () => (
<Container space="small">
// ...
</Container>
)
const InputGroup = () => (
<Container space="medium">
// ...
</Container>
) And we can use all of these components for the layout above: const Form = () => (
<Container space="medium">
<InputGroup />
<ButtonGroup /> // Pretend we have multiple buttons in the form
</Container>
) That's just my thought, but the implementation or even technical design don't mean much at this phase though. We will need to revisit all of the layouts we have and write down the spec first :) |
First time contributer here looking to get involved. These seems something on my level. Let me know if you would like me to implement one of the above ideas? |
@nichgalzin Thank you for your interest. This issue is not open for contributions at the moment. Please check issues labeled with |
Thanks @huyenltnguyen. I'll do that. |
Describe the issue
During freeCodeCamp/freeCodeCamp#52092, I found that the
ui-components
buttons don't automatically space out when they stack on top of each other, and the library also doesn't have a prop or a component to handle this sort of arrangement.Comparison:
To unblock the migration, I temporarily used the
Spacer
component in /learn to manually add a gap between the buttons (see freeCodeCamp/freeCodeCamp#52577).Solution
Some approaches off the top of my head:
ui-components
that handles layout arrangement, including direction (vertical and horizontal) and content spacingMy thoughts:
I'm personally against (1). I think atomic components such as Button should be made as dumb as possible, and they shouldn't be aware of their layout context to compute their styles.
That leaves me with option (2). I would call this new component
Container
as the described responsibilities fit the name. However, we already have aContainer
component inui-components
, which at the moment is just a wrapper that controls width and pads its content. So we would need to either find a new name for this component or updateContainer
to support these capabilities.References
How Bootstrap handles the button spacing: https://github.com/twbs/bootstrap/blob/f17f882df292b29323f1e1da515bd16f326cee4a/less/buttons.less#L156-L159
The text was updated successfully, but these errors were encountered: