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
import "scss/partials/pages/_homepage.scss"; | |
export default class Homepage { | |
... | |
} |
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
let currentView = null; | |
const pageLoaded = () => { | |
// "Routing" | |
const currentPage = document.querySelector("#content").firstElementChild; | |
switch (currentPage.id) { | |
case "home-page": | |
import(/* webpackChunkName: "homepage" */ "pages/homepage/homepage") | |
.then(currentViewImported) |
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
import Turbolinks from "turbolinks"; | |
Turbolinks.start(); | |
// When you just clicked on a link | |
document.addEventListener("turbolinks:before-visit", e => { | |
... | |
}); | |
// When the transition is happening |
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
<? | |
function register_scripts() { | |
// include the base style in the header. | |
$base_js = WP_DEBUG ? 'http://localhost:8080/bundle.js' : get_stylesheet_directory_uri() . ( '/static/app.js' ); | |
wp_register_script( | |
'base-script', // handle name. | |
$base_js, | |
null, // an array of dependent styles. |
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
const devServer = {}; | |
const webpack = require("webpack"); | |
const ENV = process.env.NODE_ENV === "production" ? "production" : "development"; | |
const outputPath = | |
ENV === "production" | |
? path.resolve(__dirname + "../../static/") | |
: path.resolve(__dirname + "/dist/"); |
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
... | |
render() { | |
const { openedMenu, onOpenMenu, state } = this.props; | |
return <button | |
id="menu-hamburger" | |
aria-controls="menu-mobile" | |
aria-expanded={openedMenu} | |
aria-haspopup={true} |
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
// Here is a simple class that contains loading methods. | |
// Nothing fancy, but the idea is simply to return a Promise | |
import { loadImg } from './load'; | |
class Sprite { | |
/* | |
@Example | |
import Sprite from './Sprite'; |
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
// Update the path of the assets in the animation data to use CMS assets instead (optmized) | |
const updateAnimationData = (assets, animationData, maxAssetWidth) => { | |
const refIdDictionary = []; | |
animationData.assets.forEach((asset, i) => { | |
if (!asset.u || !asset.id) return; | |
// replace id | |
const newId = asset.p.split('.')[0]; | |
const prevId = asset.id !== newId ? asset.id : `image_${i}`; |
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
class LottieWebAnimation extends React.Component { | |
/* | |
.. render()... | |
*/ | |
// Capturing mouse move | |
onMouseMove = (e) => { | |
this.mouseCoords.x = e.clientX || e.pageX; | |
this.mouseCoords.y = e.clientY || e.pageY; |