Skip to content

Commit

Permalink
Change number of columns based on number of kits [TMZ-178] (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoladj77 authored Nov 26, 2024
1 parent 06c5582 commit ce9aaf5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ import Grid from '@elementor/ui/Grid';
import { PreviewWithImage } from '../../preview/preview-with-image';

export const InstallKit = ( { message, kits = [], setPreviewKit, severity } ) => {
let md = 3;

if ( 0 !== kits.length % 4 && 0 === kits.length % 3 ) {
// if a number is divisble by 3 update to 3
md = 4;
}

return (
<Stack direction="column" alignItems="center" justifyContent="center">
<Stack direction="column" alignItems="center" justifyContent="center" sx={ { overflowY: 'auto' } }>
<Stack sx={ { maxWidth: 900 } } alignItems="center" justifyContent="center" gap={ 4 }>
<Navigation />
<Stack alignItems="center" justifyContent="center" gap={ 4 }>
Expand All @@ -27,7 +34,7 @@ export const InstallKit = ( { message, kits = [], setPreviewKit, severity } ) =>

<Grid container rowSpacing={ 3 } columnSpacing={ 5 } >
{ kits.map( ( kit ) => (
<Grid key={ kit._id } item xs={ 12 } sm={ 6 } md={ 3 }>
<Grid key={ kit._id } item xs={ 12 } sm={ 6 } md={ md }>
<PreviewWithImage { ...kit } onClick={ () => {
setPreviewKit( kit );
} } />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { __ } from '@wordpress/i18n';

export const TopBarContent = ( { sx = {}, iconSize = 'medium', onClose } ) => {
return (
<Stack direction="row" sx={ { alignItems: 'center', height: 50, px: 2, backgroundColor: 'background.default', justifyContent: 'space-between', ...sx } }>
<Stack direction="row" sx={ { alignItems: 'center', minHeight: 50, px: 2, backgroundColor: 'background.default', justifyContent: 'space-between', ...sx } }>
<Stack direction="row" spacing={ 1 } alignItems="center">
<SvgIcon fontSize={ iconSize } color="secondary">
<ElementorNoticeIcon />
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/assets/js/pages/onboarding-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const OnboardingPage = () => {
return (
<ThemeProvider colorScheme="auto">
<Modal open sx={ { zIndex: 100000 } } >
<Box style={ { ...style, display: 'flex', flexDirection: 'column' } }>
<Box style={ { ...style, display: 'flex', flexDirection: 'column', py: 4 } }>
{ ! previewKit && ( <TopBarContent onClose={ onClose } sx={ { borderBottom: '1px solid var(--divider-divider, rgba(0, 0, 0, 0.12))', mb: 4 } } iconSize="small" /> ) }
{ 0 === step && ! isLoading && ! previewKit && (
<GetStarted allowTracking={ allowTracking } setAllowTracking={ setAllowTracking } severity={ severity } message={ message } buttonText={ buttonText } onClick={ onClick } />
Expand Down

0 comments on commit ce9aaf5

Please sign in to comment.