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
//this is basic ternary JS inside a function block but outside of the return(...jsx code...) block | |
//if regularMarketChange is LT 0 then set red, else green | |
{response.data.price.regularMarketChange.fmt < 0 ? setQuoteColor('red') : setQuoteColor('green') }; | |
//this is ternary JS inside JSX | |
//Notice the implementation of the quoteColor variable (set above) in the Nav tag below | |
//If the value in the marketChange variable is GT 0 then display +, else display - (notice the quotes!) | |
<Nav | |
className="nav-tabs-neutral" | |
role="tablist" |
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
//Read 'if the value in institutions is true, then execute the following .map() code'. I think it's an ES6 thing.... | |
{ institutions && | |
institutions.map((institutions) => ( | |
<tr key={institutions.organization}> | |
<td width="15%"> | |
{institutions.pctHeld.fmt} | |
</td> | |
<td width="60%"> | |
{institutions.organization} | |
</td> |
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 from 'react'; | |
import Spinner from '../../layout/Spinner'; | |
import UserItem from './components/UserItem'; | |
const Users = ({users, loading}) => { | |
if(loading) return <Spinner/> | |
} else { | |
return( | |
<div style={UserStyle}> | |
{users.map(user) => ( |
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
<Table hover> | |
<tbody> | |
{grades && | |
grades.map((grades) => { | |
const displayActionMap = { | |
init: 'initiated', | |
down: 'downgrade', | |
reit: 'reiterates', | |
up: 'upgrade', |
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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>SANDBOX</title> | |
<style type="text/css"> | |
.heading { | |
color: darkblue; | |
font-size: 15px; | |
/*transition-property: font-size; |
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
// define all CSS variables in the root block | |
:root { | |
--main-color: blue; | |
} | |
.hover-text { | |
transition: all 0.5s; | |
} | |
//apply CSS variables using var() method and the variable name |
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
:root { | |
--main-color: blue; | |
} | |
.hover-text { | |
transition: all 3s; | |
} | |
.hover-text:hover { | |
color: var(--main-color); |
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
<!-- I got this code from Brad's youtube video (https://www.youtube.com/watch?v=-qOe8lBAChE) about laying down a full-sized | |
background image behind a CSS grid. It uses a CSS grid (obviously) but also some CSS wizardry including: | |
· Background images (think "windows in the grid exposing the background image behind") | |
· CSS animations (transitions) | |
· A few handy CSS selectors that I normally learn about once a year then promptly forget (not kidding) | |
· Grid spacing and layout --> | |
<!doctype html> | |
<head> | |
<meta charset="UTF-8"> |
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
<!-- copy and paste entire file and open in browser. | |
Simple layout using flexbox to build columns, I always seem to forget how to do this.... | |
--> | |
<html> | |
<head> | |
<title>HTML & CSS</title> | |
<style> | |
body { | |
margin: 0; |
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
//FETCH, JSON, FOREACH & DIV.INNERHTML EXAMPLE | |
//fetch a json file, loop through each value in the json file and print it out to a div on screen | |
//this is the contents of the people.json file that would need to be located in the same directory to work on your machine | |
[ | |
{"name": "John", | |
"age": 20}, | |
{"name": "Mary", | |
"age": 24}, | |
{"name": "Bob", |
OlderNewer