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
// ------------------- | |
/* script.js */ | |
// ------------------- | |
// ... prev code | |
const rootDirectoryPath = `./src/articles/${readType}/${directoryName}`; | |
const componentsDirectoryPath = `${rootDirectoryPath}/components`; | |
// Create directories |
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
<nav aria-label="Primary"> | |
<ul> | |
<li><a href="/articles/sass">Sass</a></li> | |
<li> | |
<a href="/articles/javascript">Javascript</a> | |
<!-- Notice how the <nav> element does NOT added again --> | |
<ul> | |
<li><a href="/articles/javascript/promises">Promises</a></li> | |
<li><a href="/articles/javascript/vanilla">Vanilla</a></li> | |
</ul> |
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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
if (process.env.NODE_ENV !== 'production') { | |
import('@axe-core/react').then((axe) => { | |
axe(React, ReactDOM, 1000, {}, '#root'); // optional 5th arg node or arr | |
}); | |
} |
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 React from 'react'; | |
import PropTypes from 'prop-types'; | |
const Video = ({ src }) => ( | |
<div className="media-container"> | |
<video className="video" autoPlay loop muted playsInline> | |
<source src={src} type="video/mp4" loop /> | |
</video> | |
</div> | |
); |
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 readline = require('readline'); | |
const userInterface = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}); | |
userInterface.question('What is 5x5?', (answer) => { | |
Number(answer) === 25 | |
? console.log('WELL DONE... ✔️') |
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
/* ------------------------------ | |
utils.js | |
------------------------------ */ | |
const readline = require('readline'); | |
const createUserInterface = () => | |
readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}); |
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 chalk = require('chalk'); | |
const drawLine = (color) => | |
console.log(chalk[color]('-'.repeat(process.stdout.columns))); | |
const centerAlign = (string) => { | |
const padding = (process.stdout.columns - string.length) / 2; | |
return `${' '.repeat(padding)}`; | |
}; |
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 changeEmojiDisplayAsync = (type = 'show') => { | |
console.log('2'); | |
const elements = document.getElementsByClassName('spooky-emoji-async'); | |
for (let element of elements) { | |
setTimeout(() => { | |
console.log('(3) change element className'); | |
element.className = `spooky-emoji-async spooky-emoji-async--${type}`; | |
}, 2000); | |
} | |
}; |
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 changeEmojiDisplay = (type = 'show') => { | |
console.log('2'); | |
const elements = document.getElementsByClassName('spooky-emoji'); | |
for (let element of elements) { | |
console.log('(3) change element className'); | |
element.className = `spooky-emoji spooky-emoji--${type}`; | |
} | |
}; | |
const changeTextDisplay = (type = 'show') => { |
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
// imported from utils | |
const styleInterface = document.documentElement.style; | |
<label> | |
Background Color: | |
<input | |
type="color" | |
onChange={(event) => | |
styleInterface.setProperty(`--background-body`, event.target.value) | |
} |
NewerOlder