This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
[Gutenberg] Build a base layer for Homepage #13
Merged
Merged
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
7cfcb28
Add base for Gutenberg blocks + blocks base for activity-list, discov…
miina 5876ef3
Empty index.
miina 2c6744d
Remove featured block.
miina c2cf477
Add index.php file placeholder. Add copied style from Travel theme.
miina 4d74f0d
Add featured block.
miina f963aac
Add Popular block.
miina bd1ab4a
Add Hero block.
miina 5e8e3aa
Add Travel Angle block for design.
miina 59f25d5
Improve block's name.
miina 4480d69
Fix some CS issues.
miina 97bbaf2
Add Mustache template to Hero block.
miina 0eac19d
Add demo.json file for amp-list. Fix some editor validation issues.
miina 472ede6
Add a workaround for React not supporting [src].
miina d301cc0
Merge branch 'develop' into feature/12-gutenberg_blocks_base
ThierryA f7ada7e
Fix some CS issues.
miina 5f74431
Fix gitignore.
miina 876899b
Merge branch 'develop' into feature/12-gutenberg_blocks_base
ThierryA 912f8c2
Use same method for save and edit where possible. Fix some indent iss…
miina 2feb47a
Eliminate duplication of static markup for editor by doing basic de-a…
westonruter d46ede6
Fix dev-lib being able to run eslint; fix some eslint issues
westonruter b18c6c4
Fix eslint issues.
miina ca8c0ce
Fix AMP validation issues. Reuse the same method for edit-save within…
miina 946e1f5
Move blocks-related code away from functions.php file. Add allowed ht…
miina 2edb79a
Remove comment. Fix phpcs.
miina 81529db
Merge amp-img allowed atts with img.
miina ff30b34
Restructure.
miina f9d9361
Restructure theme code.
miina 7f23e78
Add init method to blocks class.
miina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"modules": false | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"transform-object-rest-spread", | ||
[ | ||
"transform-react-jsx", | ||
{ | ||
"pragma": "wp.element.createElement" | ||
} | ||
] | ||
], | ||
"env": { | ||
"default": { | ||
"plugins": ["transform-runtime"] | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
**/*.min.js | ||
**/node_modules/** | ||
**/vendor/** | ||
**/assets/** |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
vendor | ||
node_modules | ||
/node_modules | ||
.idea | ||
package-lock.json |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,71 @@ | ||
/** | ||
* Internal block libraries. | ||
*/ | ||
const { __ } = wp.i18n; | ||
const { registerBlockType } = wp.blocks; | ||
|
||
/** | ||
* Register block. | ||
*/ | ||
export default registerBlockType( | ||
'amp-travel/discover', | ||
{ | ||
title: __( 'Discover block' ), | ||
category: 'common', | ||
icon: 'wordpress-alt', | ||
keywords: [ | ||
__( 'Adventures' ), | ||
__( 'Travel' ) | ||
], | ||
|
||
// Copy from Travel HTML template. | ||
edit: props => { | ||
return ( | ||
<section className='travel-discover py4 mb3 relative xs-hide sm-hide'> | ||
<div className='max-width-3 mx-auto px1 md-px2'> | ||
<div className='flex justify-between items-center'> | ||
<header> | ||
<h2 className='travel-discover-heading bold line-height-2 xs-hide sm-hide'>Discover<br className='md-hide lg-hide'/> Adventures</h2> | ||
<div className='travel-discover-subheading h2 xs-hide sm-hide'>Get inspired and find your next big trip</div> | ||
</header> | ||
|
||
<div className='travel-discover-panel travel-shadow-hover px3 py2 ml1 mr3 myn3 xs-hide sm-hide'> | ||
<div className='bold h2 line-height-2 my1'>From the blog</div> | ||
<p className='travel-discover-panel-subheading h3 my1 line-height-2'> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit amet dolor set. | ||
</p> | ||
<p className='my1'> | ||
<a className='travel-link' href='#'>Read more</a> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
}, | ||
save: props => { | ||
return ( | ||
<section className='travel-discover py4 mb3 relative xs-hide sm-hide'> | ||
<div className='max-width-3 mx-auto px1 md-px2'> | ||
<div className='flex justify-between items-center'> | ||
<header> | ||
<h2 className='travel-discover-heading bold line-height-2 xs-hide sm-hide'>Discover<br className='md-hide lg-hide' /> Adventures</h2> | ||
<div className='travel-discover-subheading h2 xs-hide sm-hide'>Get inspired and find your next big trip</div> | ||
</header> | ||
|
||
<div className='travel-discover-panel travel-shadow-hover px3 py2 ml1 mr3 myn3 xs-hide sm-hide'> | ||
<div className='bold h2 line-height-2 my1'>From the blog</div> | ||
<p className='travel-discover-panel-subheading h3 my1 line-height-2'> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit amet dolor set. | ||
</p> | ||
<p className='my1'> | ||
<a className='travel-link' href='#'>Read more</a> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
} | ||
}, | ||
); |
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,153 @@ | ||
/* globals travelGlobals */ | ||
/* jscs:disable validateQuoteMarks */ | ||
|
||
/** | ||
* Internal block libraries. | ||
*/ | ||
const { __ } = wp.i18n; | ||
const { registerBlockType } = wp.blocks; | ||
|
||
/** | ||
* Register block. | ||
*/ | ||
export default registerBlockType( | ||
'amp-travel/featured', | ||
{ | ||
title: __( 'Featured' ), | ||
category: 'common', | ||
icon: 'wordpress-alt', | ||
keywords: [ | ||
__( 'Featured destinations' ), | ||
__( 'Adventures' ), | ||
__( 'Travel' ) | ||
], | ||
|
||
// Copied from Travel template HTML, removed amp tags not to break edit. | ||
edit: props => { | ||
return ( | ||
<section className='travel-featured pt3 relative clearfix'> | ||
<header className='max-width-2 mx-auto px1 md-px2 relative'> | ||
<h3 className='travel-featured-heading h1 bold line-height-2 mb2 center'>Featured Destinations</h3> | ||
</header> | ||
<div className='max-width-3 mx-auto relative'> | ||
<div className='travel-featured-grid flex flex-wrap items-stretch'> | ||
<div className='col-12 md-col-6 flex items-stretch flex-auto'> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto relative travel-featured-color-blue'> | ||
<img src={travelGlobals.themeUrl + '/img/new-york.jpg'} /> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading caps bold line-height-2 h3'>New York</div> | ||
<div className='h5'>379 adventures</div> | ||
</div> | ||
</a> | ||
<div className='flex flex-column items-stretch flex-auto'> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto relative travel-featured-color-cyan'> | ||
<img src={travelGlobals.themeUrl + '/img/barcelona.jpg'} /> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading bold caps line-height-2 h3'>Barcelona</div> | ||
<div className='h5'>68 adventures</div> | ||
</div> | ||
</a> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto pointer relative travel-featured-color-orange'> | ||
<img src={travelGlobals.themeUrl + '/img/paris.jpg'} /> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading bold caps line-height-2 h3'>Paris</div> | ||
<div className='h5'>221 adventures</div> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
<div className='col-12 md-col-6 flex items-stretch flex-auto'> | ||
<div className='flex flex-column items-stretch flex-auto'> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto pointer relative travel-featured-color-purple'> | ||
<img src={travelGlobals.themeUrl + '/img/tokyo.jpg'} /> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading caps bold line-height-2 h3'>Tokyo</div> | ||
<div className='h5'>500+ adventures</div> | ||
</div> | ||
</a> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto relative travel-featured-color-cornflower'> | ||
<img src={travelGlobals.themeUrl + '/img/chicago.jpg'} /> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading caps bold line-height-2 h3'>Chicago</div> | ||
<div className='h5'>143 adventures</div> | ||
</div> | ||
</a> | ||
</div> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto relative travel-featured-color-teal'> | ||
<img src={travelGlobals.themeUrl + '/img/reykjavik.jpg'} /> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading caps bold h3'>Reykjavik</div> | ||
<div className='h5'>87 adventures</div> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
}, | ||
save: props => { | ||
return ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 〃comments above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this block (featured) the difference between |
||
<section className='travel-featured pt3 relative clearfix'> | ||
<header className='max-width-2 mx-auto px1 md-px2 relative'> | ||
<h3 className='travel-featured-heading h1 bold line-height-2 mb2 center'>Featured Destinations</h3> | ||
</header> | ||
<div className='max-width-3 mx-auto relative'> | ||
<div className='travel-featured-grid flex flex-wrap items-stretch'> | ||
<div className='col-12 md-col-6 flex items-stretch flex-auto'> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto relative travel-featured-color-blue' on="tap:AMP.setState({fields_query: 'New York', query_query: 'New York'})"> | ||
<amp-img class='travel-object-cover flex-auto' layout='responsive' width='336' height='507' src={travelGlobals.themeUrl + '/img/new-york.jpg'}></amp-img> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading caps bold line-height-2 h3'>New York</div> | ||
<div className='h5'>379 adventures</div> | ||
</div> | ||
</a> | ||
<div className='flex flex-column items-stretch flex-auto'> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto relative travel-featured-color-cyan' on="tap:AMP.setState({fields_query: 'Barcelona', query_query: 'Barcelona'})"> | ||
<amp-img class='travel-object-cover flex-auto' layout='responsive' width='264' height='246' src={travelGlobals.themeUrl + '/img/barcelona.jpg'} ></amp-img> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading bold caps line-height-2 h3'>Barcelona</div> | ||
<div className='h5'>68 adventures</div> | ||
</div> | ||
</a> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto pointer relative travel-featured-color-orange' on="tap:AMP.setState({fields_query: 'Paris', query_query: 'Paris'})"> | ||
<amp-img class='travel-object-cover flex-auto' layout='responsive' width='264' height='264' src={travelGlobals.themeUrl + '/img/paris.jpg'}></amp-img> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading bold caps line-height-2 h3'>Paris</div> | ||
<div className='h5'>221 adventures</div> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
<div className='col-12 md-col-6 flex items-stretch flex-auto'> | ||
<div className='flex flex-column items-stretch flex-auto'> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto pointer relative travel-featured-color-purple' on="tap:AMP.setState({fields_query: 'Tokyo', query_query: 'Tokyo'})"> | ||
<amp-img class='travel-object-cover flex-auto' layout='responsive' width='276' height='207' src={travelGlobals.themeUrl + '/img/tokyo.jpg'}></amp-img> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading caps bold line-height-2 h3'>Tokyo</div> | ||
<div className='h5'>500+ adventures</div> | ||
</div> | ||
</a> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto relative travel-featured-color-cornflower' on="tap:AMP.setState({fields_query: 'Chicago', query_query: 'Chicago'})"> | ||
<amp-img class='travel-object-cover flex-auto' layout='responsive' width='264' height='286' src={travelGlobals.themeUrl + '/img/chicago.jpg'}></amp-img> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading caps bold line-height-2 h3'>Chicago</div> | ||
<div className='h5'>143 adventures</div> | ||
</div> | ||
</a> | ||
</div> | ||
<a href='travel-results.amp' className='travel-featured-tile flex flex-auto relative travel-featured-color-teal' on="tap:AMP.setState({fields_query: 'Reykjavik', query_query: 'Reykjavik'})"> | ||
<amp-img class='travel-object-cover flex-auto' layout='responsive' width='312' height='507' src={travelGlobals.themeUrl + '/img/reykjavik.jpg'}></amp-img> | ||
<div className='travel-featured-overlay absolute z1 center top-0 right-0 bottom-0 left-0 white p2'> | ||
<div className='travel-featured-tile-heading caps bold h3'>Reykjavik</div> | ||
<div className='h5'>87 adventures</div> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
} | ||
}, | ||
); |
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,14 @@ | ||
{ | ||
"items": [ | ||
{ | ||
"predictions": [ | ||
{ | ||
"description": "Barcelona" | ||
}, | ||
{ | ||
"description": "Tokyo" | ||
} | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, the
save
function is identical to theedit
function, so I think the two functions should both call a common function that returns the markup.