Skip to content

Commit

Permalink
(fix) Fixup ResponsiveWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Feb 9, 2024
1 parent 7c9ee86 commit b05ba1a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import React from 'react';
import { Layer } from '@carbon/react';
import { useLayoutType } from '@openmrs/esm-framework';

export type ResponsiveWrapperProps = {
export interface ResponsiveWrapperProps {
children: React.ReactNode;
};
}

/**
* ResponsiveWrapper enables a responsive behavior for the component its wraps, providing a different rendering based on the current layout type.
* On desktop, it renders the children as is, while on a tablet, it wraps them in a Carbon Layer https://react.carbondesignsystem.com/?path=/docs/components-layer--overview component.
* This provides a light background for form inputs on tablets, in accordance with the design requirements.
*/
export function ResponsiveWrapper({ children }: ResponsiveWrapperProps) {
export const ResponsiveWrapper: React.FC<ResponsiveWrapperProps> = ({ children }) => {
const layout = useLayoutType();
const isTablet = layout === 'tablet';

Expand All @@ -20,4 +20,4 @@ export function ResponsiveWrapper({ children }: ResponsiveWrapperProps) {
}

return <>{children}</>;
}
};

0 comments on commit b05ba1a

Please sign in to comment.