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

Hotfix/885 column width #948

Merged
merged 3 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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