This file contains hidden or 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
// get feature image inside loop | |
<?php | |
if (has_post_thumbnail()) { // check if the post has a Post Thumbnail assigned to it. | |
the_post_thumbnail('full', array('class' => 'img-fluid d-block')); // show featured image | |
} else { ?> | |
<img src="https://via.placeholder.com/1200x750" alt="" class="img-fluid d-block"> | |
<?php } ?> | |
// get images from files |
This file contains hidden or 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
// css | |
#loadingScreen { | |
height: 100vh; | |
-webkit-box-pack: center; | |
-ms-flex-pack: center; | |
justify-content: center; | |
-webkit-box-align: center; | |
-ms-flex-align: center; | |
align-items: center; |
This file contains hidden or 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
// parent | |
<BottomSheet | |
primaryBtn={ | |
<Button | |
children="Primary Action" | |
licon="lock-f" | |
onClick={action("primaryBtn Action")} | |
/> | |
} |
This file contains hidden or 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 React, { PureComponent } from "react"; | |
import PropTypes from "prop-types"; | |
import styles from "./TextArea.css"; | |
class TextArea extends PureComponent { | |
constructor(props) { | |
super(props); | |
} | |
render() { |
This file contains hidden or 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
// Rest 剩下的, Spread 展開 , Destructuring 將陣列或物件中的資料取出成獨立變數 | |
// Array Example | |
// let a, b | |
// [a, b, ...c] = [1, 2, 3, 4, 5] | |
// c | |
// Obj Example | |
// ({a, b, ...c} = {a: 1, b: 2, c: 3, d: 4, e: 5}) |
This file contains hidden or 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
// es5 classes | |
// function Person(name, age) { | |
// this.name = name; | |
// this.age = age; | |
// } | |
// Person.prototype.sayHi = function () { |
This file contains hidden or 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 logWord(word) { | |
return new Promise(function (resolve, reject) { | |
setTimeout(function() { | |
console.log(word) | |
resolve() | |
}, Math.floor(Math.random() * 100) + 1) | |
}) | |
} | |
// function logAll() { |
This file contains hidden or 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
// add Block Scope 限制在這個區塊 | |
// ES6 | |
// let x = 2; | |
// if (x === 2) { | |
// let x = 5; | |
// console.log(x); | |
// } | |
// console.log(x); |
This file contains hidden or 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
// Simple Example | |
// 1. Better Looking (sugar syntax) | |
// function sayHi() { | |
// console.log('Hello world') | |
// } | |
// const sayHi = user => { | |
// console.log('Hello world ' + user) | |
// } |