Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructured to be closer to HTML partials version. #896

Open
wants to merge 2 commits into
base: ampstart-2.0
Choose a base branch
from
Open
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
62 changes: 0 additions & 62 deletions templates/travel/components/ActivitiesPanel.js

This file was deleted.

20 changes: 0 additions & 20 deletions templates/travel/components/ActivityButton.js

This file was deleted.

61 changes: 61 additions & 0 deletions templates/travel/components/activities/Activities.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import ActiveSvg from '../svg/ActiveSvg';
import ArtisticSvg from '../svg/ArtisticSvg';
import DrinksSvg from '../svg/DrinksSvg';
import FashionSvg from '../svg/FashionSvg';
import FoodSvg from '../svg/FoodSvg';
import MusicSvg from '../svg/MusicSvg';
import NatureSvg from '../svg/NatureSvg';
import NightlifeSvg from '../svg/NightlifeSvg';
import ToursSvg from '../svg/ToursSvg';
import WaterSvg from '../svg/WaterSvg';

export default function Activities(props) {
return (
<section className='travel-activities pb4 pt3 relative'>
<div className='max-width-3 mx-auto px1 md-px2'>
<h3 className='bold h1 line-height-2 mb2 md-hide lg-hide' aria-hidden='true'>
Browse
<br />
by activity
</h3>
<h3 className='bold h1 line-height-2 mb2 xs-hide sm-hide center'>Browse by activity</h3>
</div>
<div className='overflow-scroll'>
<div className='travel-overflow-container'>
<div className='flex justify-center p1 md-px1 mxn1'>
{[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: extract the list into a variable

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems also to duplicate TravelData

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some I converted from result of converter and then reverse engineered the source template. Next one I think should port the Mustache files rather than the output of the conversion. There are few like this around the place I have not done yet.

{name: 'active', title: 'Active', icon: <ActiveSvg />},
{name: 'artistic', title: 'Artistic', icon: <ArtisticSvg />},
{name: 'drinks', title: 'Drinks', icon: <DrinksSvg />},
{name: 'fashion', title: 'Fashion', icon: <FashionSvg />},
{name: 'food', title: 'Food', icon: <FoodSvg />},
{name: 'music', title: 'Music', icon: <MusicSvg />},
{name: 'nature', title: 'Nature', icon: <NatureSvg />},
{name: 'nightlife', title: 'Nightlife', icon: <NightlifeSvg />},
{name: 'tours', title: 'Tours', icon: <ToursSvg />},
{name: 'water', title: 'Water', icon: <WaterSvg />},
].map(item => (
<a
key={item.name}
href='results'
className={`travel-activities-activity travel-type-${item.name} mx1`}
on='
tap:AMP.setState({display: {
ui_viewIndex: 1,
fields_type: [item.name],
query_type: [item.name]
}})
'
>
<div className='travel-shadow circle inline-block'>
<div className='travel-activities-activity-icon'>{item.icon}</div>
</div>
<p className='bold center line-height-4'>{item.title}</p>
</a>
))}
</div>
</div>
</div>
</section>
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function AnglesArtwork() {
export default function Angles() {
return (
<div className='travel-angles max-width-3 mx-auto'>
<div className='travel-angle-left'>
Expand Down
202 changes: 202 additions & 0 deletions templates/travel/components/data/TravelData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
export default function TravelData() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels very hard to read and it also seems to mix different kinds of data (domain and presentational data). I think it'd be better to split this up into multiple files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was copied out of the original template - I have not got to the bottom of the two sets of data - feels like some overlap there as well. Let's work out what we want as components to be listed separately - that might also help clean all this up as well.

return {
travel: {
data: {
types: [
{text: 'Active', value: 'active', icon: {run: true}},
{text: 'Artistic', value: 'artistic', icon: {paintbrush: true}},
{text: 'Drinks', value: 'drinks', icon: {cocktail: true}},
{text: 'Fashion', value: 'fashion', icon: {jacket: true}},
{text: 'Food', value: 'food', icon: {cutlery: true}},
{text: 'Music', value: 'music', icon: {guitar: true}},
{text: 'Nature', value: 'nature', icon: {pine: true}},
{text: 'Nightlife', value: 'nightlife', icon: {moon: true}},
{text: 'Tours', value: 'tours', icon: {bus: true}},
{text: 'Water', value: 'water', icon: {boat: true}},
],
},
'head-tag': {
title: 'Travel Template',
'canonical-path': 'templates/travel/travel.amp',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't needed either

extensions: ['amp-list', 'amp-bind'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no longer needed

templates: ['amp-mustache'],
'css-path': 'templates/travel/travel.css',
'font-stylesheets': ['https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700'],
},
partials: {
hero: {
images: [
{
src: '../../img/travel/hero-2.jpg',
},
{
src: '../../img/travel/hero-3.jpg',
},
{
src: '../../img/travel/hero-1.jpg',
},
],
},
featured: {
'image-col-1': {
'overlay-color': 'travel-featured-color-blue',
width: 336,
height: 507,
src: 'new-york',
name: 'New York',
'adventure-number': '379 adventures',
},
'image-col-2-top': {
'overlay-color': 'travel-featured-color-cyan',
width: 264,
height: 246,
src: 'barcelona',
name: 'Barcelona',
'adventure-number': '68 adventures',
},
'image-col-2-bottom': {
'overlay-color': 'travel-featured-color-orange',
width: 264,
height: 264,
src: 'paris',
name: 'Paris',
'adventure-number': '221 adventures',
},
'image-col-3-top': {
'overlay-color': 'travel-featured-color-purple',
width: 276,
height: 207,
src: 'tokyo',
name: 'Tokyo',
'adventure-number': '500+ adventures',
},
'image-col-3-bottom': {
'overlay-color': 'travel-featured-color-cornflower',
width: 264,
height: 286,
src: 'chicago',
name: 'Chicago',
'adventure-number': '143 adventures',
},
'image-col-4': {
'overlay-color': 'travel-featured-color-teal',
width: 312,
height: 507,
src: 'reykjavik',
name: 'Reykjavik',
'adventure-number': '87 adventures',
},
},
popular: {
adventures: [
{
'layout-classes': ['travel-popular-tilt-right'],
href: '#',
width: 346,
height: 200,
src: '../../img/travel/activity/surf-day.jpg',
src2x: '../../img/travel/activity/[email protected]',
text: 'Surf Day. Board and Wetsuits Included in Price!',
price: '100',
reviews: '241 Reviews',
place: 'Oaxaca',
new: false,
},
{
'layout-classes': ['travel-results-result relative'],
href: '#',
width: 346,
height: 200,
src: '../../img/travel/activity/discover-electronic-scene.jpg',
src2x: '../../img/travel/activity/[email protected]',
text: "Discover Oaxaca's Electronic Music Scene with a Top DJ",
price: '113',
reviews: '42 Reviews',
place: 'Oaxaca',
new: true,
},
{
'layout-classes': ['travel-popular-tilt-left'],
href: '#',
width: 346,
height: 200,
src: '../../../img/travel/activity/skateboard-around-city.jpg',
src2x: '../../../img/travel/activity/[email protected]',
text: 'Skateboard Around the City',
price: '92',
reviews: '17 Reviews',
place: 'Mexico City',
new: false,
},
],
},
},
'apply-button-props': [
{
key: 'ui_reset',
value: 'false',
},
{
key: 'ui_filterPane',
value: 'false',
},
{
key: 'query_query',
value: 'fields_query',
},
{
key: 'fields_query_edited',
value: 'false',
},
{
key: 'query_departure',
value: 'fields_departure',
},
{
key: 'fields_departure_edited',
value: 'false',
},
{
key: 'query_return',
value: 'fields_return',
},
{
key: 'fields_return_edited',
value: 'false',
},
{
key: 'query_maxPrice',
value: 'fields_maxPrice',
},
{
key: 'fields_maxPrice_edited',
value: 'false',
},
{
key: 'query_city',
value: 'fields_city',
},
{
key: 'fields_city_edited',
value: 'false',
},
{
key: 'query_type',
value: 'fields_type',
},
{
key: 'fields_type_edited',
value: 'false',
},
{
key: 'query_sort',
value: 'fields_sort',
},
{
key: 'fields_sort_edited',
value: 'false',
},
],
},
};
}
Loading