-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jetpack Tiled Gallery Block:
save
functionality (#21481)
* [not verified] WIP implementation of save. * [not verified] WIP: Got block attributes to show up in serialization * [not verified] Make columnWidths nested array * [not verified] WIP: Now converts serialized HTML images to inner blocks on load if they weren't already in store. * [not verified] WIP load from save. Hacked in stuff to make it work. Need to find root cause. * Adding Platform checks to ensure that mobile changes don't affect web. Fixing some lint warnings. Co-authored-by: Wendy Chen <wendy.chen@automattic.com> Co-authored-by: Paul Von Schrottky <paul.von.schrottky@automattic.com>
- Loading branch information
1 parent
02ba492
commit 6f9ba31
Showing
6 changed files
with
84 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
projects/plugins/jetpack/extensions/blocks/tiled-gallery/save.native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import Layout from './layout'; | ||
import { defaultColumnsNumber } from './edit'; | ||
|
||
export default function TiledGallerySave( { attributes, innerBlocks } ) { | ||
if ( ! innerBlocks.length ) { | ||
return null; | ||
} | ||
|
||
const { | ||
align, | ||
className, | ||
columns = defaultColumnsNumber( innerBlocks ), | ||
linkTo, | ||
roundedCorners, | ||
columnWidths, | ||
ids, | ||
} = attributes; | ||
|
||
return ( | ||
<Layout | ||
align={ align } | ||
className={ className } | ||
columns={ columns } | ||
images={ innerBlocks.map( innerBlock => ( { | ||
...innerBlock.attributes, | ||
height: 100, | ||
width: 100, | ||
} ) ) } | ||
isSave | ||
layoutStyle={ 'square' } | ||
linkTo={ linkTo } | ||
roundedCorners={ roundedCorners } | ||
columnWidths={ columnWidths } | ||
ids={ ids } | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters