Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 9b81a38

Browse files
authored
Merge pull request #948 from WebDevStudios/hotfix/885-column-width
Hotfix/885 column width
2 parents 4556fc1 + d2a6be4 commit 9b81a38

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

components/atoms/Columns/Columns.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import styles from './Columns.module.css'
1313
* @param {object} props.children React children.
1414
* @param {object} props.style Custom columns styles.
1515
* @param {string} props.verticalAlignment Vertical alignment of columns.
16+
* @param {boolean} props.isStackedOnMobile Checks if the columns are stacked.
1617
* @return {Element} The Columns component.
1718
*/
1819
export default function Columns({
@@ -21,13 +22,15 @@ export default function Columns({
2122
columnCount,
2223
children,
2324
style,
24-
verticalAlignment
25+
verticalAlignment,
26+
isStackedOnMobile
2527
}) {
2628
return (
2729
<div
2830
id={id || null}
2931
className={cn(
3032
styles.columns,
33+
isStackedOnMobile && styles.columnStacked,
3134
columnCount && styles[`columns-${columnCount}`],
3235
className,
3336
verticalAlignment === 'center' ? styles.alignCenter : null,

components/atoms/Columns/Columns.module.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
.columns {
2-
@apply flex flex-row gap-8;
2+
@apply flex gap-8;
3+
4+
&.columnStacked {
5+
@apply flex-col md:flex-row;
6+
}
37

48
&.alignCenter {
59
& .column {
@@ -18,7 +22,7 @@
1822
}
1923

2024
& .column {
21-
@apply flex flex-col;
25+
@apply flex flex-col w-full;
2226

2327
&.hasBackground {
2428
@apply p-4;

components/blocks/core/BlockColumns/BlockColumns.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import PropTypes from 'prop-types'
1717
* @param {object} props.innerBlocks The array of inner blocks to display.
1818
* @param {object} props.style The style attributes.
1919
* @param {string} props.textColorHex The text color hex value.
20+
* @param {boolean} props.isStackedOnMobile Checks if the columns are stacked.
2021
* @param {string} props.verticalAlignment Vertical alignment of columns.
2122
* @return {Element} The Columns component.
2223
*/
@@ -28,7 +29,8 @@ export default function BlockColumns({
2829
innerBlocks,
2930
style,
3031
textColorHex,
31-
verticalAlignment
32+
verticalAlignment,
33+
isStackedOnMobile
3234
}) {
3335
const columnsStyle = getBlockStyles({
3436
backgroundColorHex,
@@ -46,14 +48,15 @@ export default function BlockColumns({
4648
columnCount={innerBlocks?.length}
4749
style={columnsStyle}
4850
verticalAlignment={verticalAlignment}
51+
isStackedOnMobile={isStackedOnMobile}
4952
>
5053
{innerBlocks.map(({attributes, innerBlocks}, index) => {
5154
const columnStyle = getBlockStyles({
5255
backgroundColorHex: attributes?.backgroundColorHex,
5356
gradientHex: attributes?.gradientHex,
5457
textColorHex: attributes?.textColorHex,
5558
style: attributes?.style,
56-
width: attributes?.width || '50%'
59+
width: attributes?.width
5760
})
5861

5962
return (

0 commit comments

Comments
 (0)