Skip to content

feat: adding custom breakpoint interface#23

Merged
Hyperkid123 merged 2 commits intopatternfly:mainfrom
Jakub007d:breakpoint
Feb 25, 2026
Merged

feat: adding custom breakpoint interface#23
Hyperkid123 merged 2 commits intopatternfly:mainfrom
Jakub007d:breakpoint

Conversation

@Jakub007d
Copy link
Copy Markdown
Contributor

adding custom breakpoint interface to set breakpoints to be equivalent in old widgetized-layout setup

@Jakub007d Jakub007d marked this pull request as draft February 24, 2026 08:02
@Jakub007d Jakub007d marked this pull request as ready for review February 24, 2026 08:04
*/
export function getGridDimensions(currentWidth: number): Variants {
if (currentWidth >= breakpoints.xl) {
export function getGridDimensions(currentWidth: number, customBreakpoints?: Record<Variants, number>): Variants {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added it there and also set the default value in the GridLayout

onActiveWidgetsChange,
droppingWidgetType,
resizeWidgetConfig,
customBreakpoints,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

instead of customBreakpoints lets make it just breakpoints

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

droppingWidgetType,
resizeWidgetConfig,
customBreakpoints,
customColumns,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's call it just columns and give it a default value of the columns you use online 117

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

/** Resize configuration options */
resizeWidgetConfig?: Partial<ResizeConfig>;
/** Custom breakpoints for responsive layout (container width thresholds in px) */
customBreakpoints?: Record<Variants, number>;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should enforce the requirements of all breakpoints to be defined. so we do not get something like {sm: 111} and miss the rest.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done by making interface for breakpoints

import { defaultBreakpoints, defaultColumns, droppingElemId, getWidgetIdentifier, extendLayout, getGridDimensions } from './utils';

export const defaultBreakpoints = breakpoints;
export { defaultBreakpoints };
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why the re-export here? It should be accessible from the utils. We don't have to worry about breaking changes yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you can use the breakpoints argument directly here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed

@Hyperkid123 Hyperkid123 merged commit 7649a72 into patternfly:main Feb 25, 2026
5 checks passed
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0-prerelease.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

2 participants