@@ -5,6 +5,11 @@ import { CContainer, CCol } from '@coreui/react'
55
66export function CippMasonryItem ( { size, children, className = null } ) {
77 const columnSizes = {
8+ card : {
9+ xs : 12 ,
10+ lg : 2 ,
11+ xl : 3 ,
12+ } ,
813 single : {
914 xs : 12 ,
1015 lg : 6 ,
@@ -20,6 +25,16 @@ export function CippMasonryItem({ size, children, className = null }) {
2025 lg : 12 ,
2126 xl : 12 ,
2227 } ,
28+ full : {
29+ xs : 12 ,
30+ lg : 12 ,
31+ xl : 12 ,
32+ } ,
33+ half : {
34+ xs : 12 ,
35+ lg : 6 ,
36+ xl : 6 ,
37+ } ,
2338 }
2439
2540 return (
@@ -30,12 +45,35 @@ export function CippMasonryItem({ size, children, className = null }) {
3045}
3146
3247CippMasonryItem . propTypes = {
33- size : PropTypes . oneOf ( [ 'single' , 'double' , 'triple' ] ) ,
48+ size : PropTypes . oneOf ( [ 'single' , 'double' , 'triple' , 'full' , 'half' ] ) ,
3449 children : PropTypes . object ,
3550 className : PropTypes . string ,
3651}
3752
38- export function CippMasonry ( { children, className = null } ) {
53+ export function CippMasonry ( { columns = 3 , children, className = null } ) {
54+ const numberOfColumns = {
55+ 1 : {
56+ xs : 12 ,
57+ lg : 12 ,
58+ xl : 12 ,
59+ } ,
60+ 2 : {
61+ xs : 12 ,
62+ lg : 6 ,
63+ xl : 6 ,
64+ } ,
65+ 3 : {
66+ xs : 12 ,
67+ lg : 4 ,
68+ xl : 4 ,
69+ } ,
70+ 4 : {
71+ xs : 12 ,
72+ lg : 3 ,
73+ xl : 3 ,
74+ } ,
75+ }
76+
3977 const CippMasonryOptions = {
4078 transitionDuration : 0 ,
4179 percentPosition : true ,
@@ -50,14 +88,15 @@ export function CippMasonry({ children, className = null }) {
5088 options = { CippMasonryOptions }
5189 enableResizableChildren = { true }
5290 >
53- < CCol className = "cipp-masonry-sizer" xl = { 4 } lg = { 6 } xs = { 12 } > </ CCol >
91+ < CCol className = "cipp-masonry-sizer" { ... numberOfColumns [ columns ] } > </ CCol >
5492 { children }
5593 </ Masonry >
5694 </ CContainer >
5795 )
5896}
5997
6098CippMasonry . propTypes = {
99+ columns : PropTypes . oneOf ( [ 1 , 2 , 3 ] ) ,
61100 children : PropTypes . array ,
62101 className : PropTypes . string ,
63102}
0 commit comments