cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              This project compares the four score richest people in the world (per Forbes 1000) with 50 of the poorest nations in the world. <br>
<div id="root" class="root">
</div><br>
My references are the following links:<br>
<a href="https://www.forbes.com/billionaires/list/#version:realtime">Rich People</a><br>
and<br>
<a href="https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(PPP)_per_capita">Poor Nations</a><br>(These GDPs are the average based on information collected by the IMF, World Bank and CIA.)<br>
<ul>Fun facts:
  <li>The United States is proposing a wall along it's southern border, and proposing a cost of $25 billion to build it.</li>
  <li>The most expensive movie ever made (adjusted for inflation) is Pirates Of The Caribbean: On Stranger Tides, which estimated a $403 million budget to make.</li>
</ul>


            
          
!
            
              body {
    min-height: 100vh;
}
ul {  // UL
  font: 0.8em Arial;
  padding-top:0.2em;
  padding-left:0.14em;
  padding-bottom:-1.1em;
  margin-top:2.4em;
  margin-bottom:-1.5em;
}
li {  // LI
  font-face: Arial;
  list-style: none;
  padding:0.14em;
  &.richPersonLineItem {
    background-color: #aafbaa;
    margin-right:1em;
  }
  &.poNationLineItem {
    background-color: #c1a6a6;
    //color: white;
    margin-left:1em;
    padding-top:0.1cm;
    padding-bottom:0cm;
    
  }
}
.natName {
  background-color:#efb481;
}
.n_subtext {
  position:relative;
}
            
          
!
            
              let r = document.getElementById('root'),
//    p = document.getElementById("po"),
    richPeople = [
  {person: 'Jeff Bezos',                netWorth: 131300000000}, 
  {person: 'Warren Buffett',            netWorth: 84200000000}, 
  {person: 'Amancio Ortega',            netWorth: 69400000000},
  {person: 'Bill Gates',                netWorth: 91700000000},
  {person: 'Mark Zuckerberg',           netWorth: 70400000000},
  {person: 'Bernard Arnault',           netWorth: 84000000000},
  {person: 'Larry Page',                netWorth: 54400000000},
  {person: 'Larry Ellison',             netWorth: 56300000000},
  {person: 'Sergey Brin',               netWorth: 52800000000},
  {person: 'Carlos Helu Slim',          netWorth: 65400000000},
  {person: 'Ma Huateng',                netWorth: 49000000000},
  {person: 'The Brothers Koch (each)',  netWorth: 60000000000},
  {person: 'Jim Walton',                  netWorth: 46900000000},
  {person: 'S. Robson Walton',            netWorth: 46700000000},
  {person: 'Alice Walton',                  netWorth: 46600000000},
  {person: 'Mukesh Ambani',                 netWorth: 43400000000},
  {person: 'Jack Ma',                         netWorth: 42600000000},
  {person: 'Li Ka-Shing',                     netWorth: 37800000000},
  {person: 'Hui Ka Yan',                        netWorth: 40700000000},
  {person: 'Sheldon Adelson',                   netWorth: 40600000000},
  {person: 'Steve Ballmer',                       netWorth: 40000000000},
  {person: 'Beate Heister und Karl Albrecht Jr.', netWorth: 33400000000},
  {person: 'Maria Franca Frissolo',               netWorth: 33500000000},
  {person: 'Lee Shau Kee',                        netWorth: 32600000000},
  {person: 'Les Freres Chearavanont',             netWorth: 32600000000},
  {person: 'Georg Schaffler',                     netWorth: 29700000000},
  {person: 'Yang Huiyan',                         netWorth: 27900000000},
  {person: 'Jorge Paulo Lemann',                  netWorth: 29500000000},
  {person: 'Francois Pinault',                    netWorth: 30200000000},
  {person: 'Jacqueline Mars',                     netWorth: 28300000000},
  {person: 'John Mars',                           netWorth: 28300000000},
  {person: 'Michael Bloomberg',                   netWorth: 52900000000},
  {person: 'Phil Knight',                         netWorth: 30300000000},
  {person: 'Suzanne Klatten',                     netWorth: 27300000000},
  {person: 'David Thomson',                       netWorth: 26900000000},
  {person: 'Wang Jianlin',                        netWorth: 25600000000},
  {person: 'Joseph Safra',                        netWorth: 24800000000},
  {person: 'Michael Dell',                        netWorth: 24800000000},
  {person: 'Kjeld Kirk Kristiansen',              netWorth: 24000000000},
  {person: 'Masayoshi Son',                       netWorth: 23700000000},
  {person: 'Dietrich Mateschitz',                 netWorth: 23600000000},
  {person: 'He Xiangjian',                        netWorth: 23300000000},
  {person: 'Theo Albrecht, Jr.',                  netWorth: 23200000000},
  {person: 'Tadashi Yanai',                       netWorth: 23100000000}
];    
function brokeNation (nation, GDP, population) {
  this.nation = nation;
  this.population = population;
  this.GDP = (GDP.reduce((a, b) => a + b, 0)) / GDP.length;
  this.sumWealth = this.GDP * this.population;      //console.log(this.nation+" may be worth "+this.sumWealth);
};
let brokeNations = [
  new brokeNation ('Somalia', [400], 14317996),
  new brokeNation ('South Sudan', [1657, 2000], 12230730),
  new brokeNation ('Central African Republic', [652, 699, 700], 4594621),
  new brokeNation ('Niger', [1107, 978, 1100], 20672987),
  new brokeNation ('Mozambique', [1215, 1217, 1300], 28829476),
  new brokeNation ('The Gambia', [1667, 1689, 1700], 2051363),
  new brokeNation ('Madagascar', [1505, 1506, 1500], 24894551),
  new brokeNation ('Burundi', [814, 778, 800], 10524117),
  new brokeNation ('Eritrea', [1410, 1200], 4954645),
  new brokeNation ('Guinea', [1265, 1311, 1300], 12395924),
  new brokeNation ('Papua New Guinea', [3541, 0, 2800], 8084999),
  new brokeNation ('Haiti', [1784, 1784, 1800], 10847334),
  new brokeNation ('North Korea', [1800], 25368620),
  new brokeNation ('Mali', [2266, 2117, 1800], 14517176),
  new brokeNation ('Rwanda', [1977, 1913, 1800], 11262564),
  new brokeNation ('Uganda', [2068, 1849, 2100], 41487965),
  new brokeNation ('Zimbabwe', [1970, 2006, 2100], 16150362),
  new brokeNation ('Burkina Faso', [1782, 1720, 1800], 20107509),
  new brokeNation ('Guinea-Bissau', [1730, 1582, 1500], 1815698),
  new brokeNation ('Malawi', [1134, 1169, 1200], 18091575),
  //new brokeNation ('Kenya', [3361, 3156, 3300], 49125325), //== $160 billion
  new brokeNation ('The Sierra Leone', [1672, 1473, 1600], 7075641),
  new brokeNation ('Sao Tome And Principe', [3072, 3229, 3400], 199910),
  new brokeNation ('Djibouti', [3370, 3300], 942333),
  new brokeNation ('Togo', [1550, 1491, 1500], 7965055),
  new brokeNation ('Timor Leste', [4187, 5800], 1167242),
  new brokeNation ('The Congo', [773, 801, 800], 78736153),
  new brokeNation ('Liberia', [855, 813, 900], 4503000),
  new brokeNation ('Benin', [2119, 2168, 2000], 10872298),
  new brokeNation ('Afghanistan', [1919, 1877, 2000], 34656032),
  new brokeNation ('Yemen', [2375, 2508, 2800], 27584213),
  new brokeNation ('Palestine, West Bank And Gaza', [1323, 4300], 4550368), 
  new brokeNation ('Ghana', [4412, 4294, 4300], 27043093),
  new brokeNation ('Chad', [2445, 1991, 2800], 13670084),
  new brokeNation ('Cambodia', [3249, 3286, 3200], 15762370),
  new brokeNation ('Kyrgyzstan', [3521, 3551, 3400], 6019480),
  new brokeNation ('Tajikistan', [3008, 2980, 2800], 8734951),
  new brokeNation ('Marshall Islands', [3301, 4072, 3400], 53066),
  new brokeNation ('Micronesia', [3234, 3593, 3000], 104937),
  new brokeNation ('Cameroon', [3249, 3286, 3200], 23439189),
  new brokeNation ('Kiribati', [1823, 2047, 2200], 110136),
//  new brokeNation ('Tanzania', [3080, 2787, 3000], 55572201), //== $164 billion
  new brokeNation ('Laos', [5710, 6186, 5400], 6758353),
  new brokeNation ('Senegal', [2577, 2568, 2500], 14320055),
  new brokeNation ('Honduras', [5271, 4738, 5000], 9112867),
  new brokeNation ('Nicaragua', [5452, 5541, 5000], 6167237),
  new brokeNation ('Moldova', [5328, 5334, 5000], 2998235),
  new brokeNation ('Vanuatu', [2631, 3081, 2600], 272459),
  new brokeNation ('Mauritania', [4328, 3854, 4500], 4301018),
  new brokeNation ('Lesotho', [3601, 3029, 3000], 2203821),
  new brokeNation ('Nepal', [2479, 2468, 2500], 28982771),
  new brokeNation ('Ivory Coast', [3609, 3720, 3400], 23740424)
],
    ppl = richPeople.sort(function(a, b) {                  //sort richest on top!!!
                                      return b.netWorth - a.netWorth;
                                    }),
    nats = brokeNations.sort(function(a, b) {               //sort richest on top!!!
                                      return b.sumWealth - a.sumWealth;
                                    }),
    finalList = new Array();

//console.log("ppl are  "+ppl);

/*  START BUILDING LISTS and combining dup numbers  */
for (var p=0;p<ppl.length;p++) {
  if (p<ppl.length - 1) {
    if(ppl[p].netWorth == ppl[p+1].netWorth) {
      ppl[p].person += ' and '+ ppl[p+1].person+' (each)';
      ppl.splice(p+1, 1);
    }
  } 
  finalList.push(ppl[p]);
}
for (var n=0;n<nats.length;n++) {
  finalList.push(nats[n]); 
}//the marginTop of p has to fall where the richest poor nation matches the lowest billionaire
finalList.sort(function(a, b) {               //sort richest on top!!!
                if (a.hasOwnProperty('netWorth') && b.hasOwnProperty('sumWealth')) {
                    return b.sumWealth - a.netWorth;
                } else if (a.hasOwnProperty('sumWealth') && b.hasOwnProperty('netWorth')) {
                    return b.netWorth - a.sumWealth;
                } else if (a.hasOwnProperty('netWorth') && b.hasOwnProperty('netWorth')) {
                    return b.netWorth - a.netWorth;
                } else {
                  return b.sumWealth - a.sumWealth;
                }
               });
class MasterList extends React.Component {
 render() {
    const pn = finalList.map((fl, i) => {
       if (fl.hasOwnProperty('person')) {
         let rpLineHeight = parseInt(fl.netWorth / 500000000),
             rpFontsize = fl.netWorth / 2050000000,
             rpLineOpac = 100;
          return <li id={fl.person+"_lineItem"} className = "richPersonLineItem" key={i}
               style={{ height: rpLineHeight, 
                        fontSize: rpFontsize,
                        opacity: rpLineOpac}}
               key={fl.netWorth}>
                        {fl.person}: ${fl.netWorth.toLocaleString({ style: 'currency'})}
             </li>;
       } else {
         let pnLineHeight = parseInt(fl.sumWealth / 320250250),
             pnFontSize = fl.sumWealth / 1900000000,
             subtextFontSize = fl.sumWealth / 3400000000,
             subtextPTop = -Math.abs(fl.sumWealth / 4500000000);
         if(pnFontSize > 11) {
            return <li id={fl.nation+"_lineItem"}className = "poNationLineItem"
                  style={{height: pnLineHeight, 
                        fontSize: pnFontSize }}
                  key={fl.sumWealth}>
                        <span className="natName">{fl.nation}: </span> 
                          ${fl.sumWealth.toLocaleString({ style: 'currency'})}
                        <p className="n_subtext"
                           style={{fontSize: (subtextFontSize > 6) ? subtextFontSize : 6,
                                 top: subtextPTop}}>
                            based on a population of {fl.population} as of 2017, times 
                            an estimated national GDP (PPP) of ${fl.GDP.toLocaleString({ style: 'currency'})} USD</p>
                          
              </li>;  
         } else {
           return <li id={fl.nation+"_lineItem"}className = "poNationLineItem"
                  style={{height: 18, 
                        fontSize: 11 }}
                  key={fl.sumWealth}>
                        <span className="natName"><b>{fl.nation}</b>: </span> 
                          ${fl.sumWealth.toLocaleString({ style: 'currency'})}
              </li>;  
         }
       }
    });
    return (
      <ul>
         <h1>48 Rich People, 50 Poor Nations</h1>
        {pn}
      </ul>
    );
  }
}

ReactDOM.render(
  <MasterList />,
  r
);

            
          
!
999px
Loading ..................

Console