Skip to content

Conversation

@serebrennikovalex
Copy link
Contributor

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

Fixes #964

- 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
// # 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