summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v1/save.js')
-rw-r--r--plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v1/save.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v1/save.js b/plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v1/save.js
new file mode 100644
index 00000000..2a157a30
--- /dev/null
+++ b/plugins/jetpack/extensions/blocks/tiled-gallery/deprecated/v1/save.js
@@ -0,0 +1,31 @@
+/**
+ * Internal dependencies
+ */
+import Layout from './layout';
+import { getActiveStyleName } from '../../../../shared/block-styles';
+import { LAYOUT_STYLES } from './constants';
+
+export function defaultColumnsNumber( attributes ) {
+ return Math.min( 3, attributes.images.length );
+}
+
+export default function TiledGallerySave( { attributes } ) {
+ const { images } = attributes;
+
+ if ( ! images.length ) {
+ return null;
+ }
+
+ const { align, className, columns = defaultColumnsNumber( attributes ), linkTo } = attributes;
+
+ return (
+ <Layout
+ align={ align }
+ className={ className }
+ columns={ columns }
+ images={ images }
+ layoutStyle={ getActiveStyleName( LAYOUT_STYLES, className ) }
+ linkTo={ linkTo }
+ />
+ );
+}