feat: adding custom breakpoint interface#23
Conversation
e6d08d4 to
b816d82
Compare
| */ | ||
| export function getGridDimensions(currentWidth: number): Variants { | ||
| if (currentWidth >= breakpoints.xl) { | ||
| export function getGridDimensions(currentWidth: number, customBreakpoints?: Record<Variants, number>): Variants { |
There was a problem hiding this comment.
Can we make the second argumetn called breakpoints and make it optional and se the default value to the current breakpoints?
I think the code will be a bit cleaner:
function getGridDimensions(currentWidth: number, customBreakpoints?: typeof originalBreakpoints = originalBreakpoints): Variants There was a problem hiding this comment.
Added it there and also set the default value in the GridLayout
| onActiveWidgetsChange, | ||
| droppingWidgetType, | ||
| resizeWidgetConfig, | ||
| customBreakpoints, |
There was a problem hiding this comment.
instead of customBreakpoints lets make it just breakpoints
| droppingWidgetType, | ||
| resizeWidgetConfig, | ||
| customBreakpoints, | ||
| customColumns, |
There was a problem hiding this comment.
Let's call it just columns and give it a default value of the columns you use online 117
| /** Resize configuration options */ | ||
| resizeWidgetConfig?: Partial<ResizeConfig>; | ||
| /** Custom breakpoints for responsive layout (container width thresholds in px) */ | ||
| customBreakpoints?: Record<Variants, number>; |
There was a problem hiding this comment.
We should enforce the requirements of all breakpoints to be defined. so we do not get something like {sm: 111} and miss the rest.
There was a problem hiding this comment.
Done by making interface for breakpoints
18d4cbf to
c34d615
Compare
| import { defaultBreakpoints, defaultColumns, droppingElemId, getWidgetIdentifier, extendLayout, getGridDimensions } from './utils'; | ||
|
|
||
| export const defaultBreakpoints = breakpoints; | ||
| export { defaultBreakpoints }; |
There was a problem hiding this comment.
Why the re-export here? It should be accessible from the utils. We don't have to worry about breaking changes yet.
There was a problem hiding this comment.
Removed. I wanted to keep the consistency
| export function getGridDimensions(currentWidth: number): Variants { | ||
| if (currentWidth >= breakpoints.xl) { | ||
| export function getGridDimensions(currentWidth: number, breakpoints: Breakpoints = defaultBreakpoints): Variants { | ||
| const bp = breakpoints; |
There was a problem hiding this comment.
I think you can use the breakpoints argument directly here.
c34d615 to
c72cb5a
Compare
c72cb5a to
d01cf1e
Compare
|
🎉 This PR is included in version 1.0.0-prerelease.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
adding custom breakpoint interface to set breakpoints to be equivalent in old widgetized-layout setup