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

Commit

Permalink
Merge pull request #948 from WebDevStudios/hotfix/885-column-width
Browse files Browse the repository at this point in the history
Hotfix/885 column width
  • Loading branch information
gregrickaby authored Feb 23, 2022
2 parents 4556fc1 + d2a6be4 commit 9b81a38
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion components/atoms/Columns/Columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import styles from './Columns.module.css'
* @param {object} props.children React children.
* @param {object} props.style Custom columns styles.
* @param {string} props.verticalAlignment Vertical alignment of columns.
* @param {boolean} props.isStackedOnMobile Checks if the columns are stacked.
* @return {Element} The Columns component.
*/
export default function Columns({
Expand All @@ -21,13 +22,15 @@ export default function Columns({
columnCount,
children,
style,
verticalAlignment
verticalAlignment,
isStackedOnMobile
}) {
return (
<div
id={id || null}
className={cn(
styles.columns,
isStackedOnMobile && styles.columnStacked,
columnCount && styles[`columns-${columnCount}`],
className,
verticalAlignment === 'center' ? styles.alignCenter : null,
Expand Down
8 changes: 6 additions & 2 deletions components/atoms/Columns/Columns.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.columns {
@apply flex flex-row gap-8;
@apply flex gap-8;

&.columnStacked {
@apply flex-col md:flex-row;
}

&.alignCenter {
& .column {
Expand All @@ -18,7 +22,7 @@
}

& .column {
@apply flex flex-col;
@apply flex flex-col w-full;

&.hasBackground {
@apply p-4;
Expand Down
7 changes: 5 additions & 2 deletions components/blocks/core/BlockColumns/BlockColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import PropTypes from 'prop-types'
* @param {object} props.innerBlocks The array of inner blocks to display.
* @param {object} props.style The style attributes.
* @param {string} props.textColorHex The text color hex value.
* @param {boolean} props.isStackedOnMobile Checks if the columns are stacked.
* @param {string} props.verticalAlignment Vertical alignment of columns.
* @return {Element} The Columns component.
*/
Expand All @@ -28,7 +29,8 @@ export default function BlockColumns({
innerBlocks,
style,
textColorHex,
verticalAlignment
verticalAlignment,
isStackedOnMobile
}) {
const columnsStyle = getBlockStyles({
backgroundColorHex,
Expand All @@ -46,14 +48,15 @@ export default function BlockColumns({
columnCount={innerBlocks?.length}
style={columnsStyle}
verticalAlignment={verticalAlignment}
isStackedOnMobile={isStackedOnMobile}
>
{innerBlocks.map(({attributes, innerBlocks}, index) => {
const columnStyle = getBlockStyles({
backgroundColorHex: attributes?.backgroundColorHex,
gradientHex: attributes?.gradientHex,
textColorHex: attributes?.textColorHex,
style: attributes?.style,
width: attributes?.width || '50%'
width: attributes?.width
})

return (
Expand Down

1 comment on commit 9b81a38

@vercel
Copy link

@vercel vercel bot commented on 9b81a38 Feb 23, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.