Skip to content
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

added an ability to use different margins for different breakpoints. #964 #1016

Merged
merged 5 commits into from
Oct 7, 2019

Conversation

serebrennikovalex
Copy link
Contributor

Added an ability to use different margins, containerPaddings for different breakpoints.

Fixes #964

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
- update README;
- update default value for margin into RRGL;
* @param {String} breakpoint Breakpoint: lg, md, sm, xs and etc.
* @return {Array}
*/
getMarginPaddingValue = (param: any, breakpoint: string) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'll be better to extract this method into a separate function in this file. It doesn't seem like a member of the class and maybe we should rename it: 'getMarginPaddingValue' -> 'getIndentationValue'

README.md Outdated
@@ -359,6 +359,14 @@ breakpoints: ?Object = {lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0},
// # of cols. This is a breakpoint -> cols map, e.g. {lg: 12, md: 10, ...}
cols: ?Object = {lg: 12, md: 10, sm: 6, xs: 4, xxs: 2},

// # of margin. This is a breakpoint -> margin map, e.g. {lg: [10, 10], md: [10, 10], ...} or [10 , 10]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is a little unclear.

Suggest:

// margin (in pixels). Can be specified either as horizontal and vertical margin, e.g. `[10, 10]` or as a breakpoint -> margin map, e.g. `{lg: [10, 10], md: [10, 10], ...}.
margin: [number, number] | {[breakpoint: $Keys<breakpoints>]: [number, number]}

* @return {Array}
*/

function getIndentationValue(param: any, breakpoint: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any type here

@daynin
Copy link
Collaborator

daynin commented Oct 4, 2019

@STRML i think we should merge it

@STRML
Copy link
Collaborator

STRML commented Oct 7, 2019

LGTM, thanks.

@STRML STRML merged commit ce1f5ea into react-grid-layout:master Oct 7, 2019
@STRML STRML added this to the 0.17.0 milestone Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: Is it possible to have different margin and containerPadding config for different Breakpoints?
3 participants