-
-```js src/App.js
-import { people } from './data.js';
-import { getImageUrl } from './utils.js';
-
-export default function List() {
- const listItems = people.map(person =>
-
-
-
- {person.name}:
- {' ' + person.profession + ' '}
- known for {person.accomplishment}
-
-
- );
- return (
-
- Scientists
-
-
- );
-}
-```
-
-```js src/data.js
-export const people = [{
- id: 0,
- name: 'Creola Katherine Johnson',
- profession: 'mathematician',
- accomplishment: 'spaceflight calculations',
- imageId: 'MK3eW3A'
-}, {
- id: 1,
- name: 'Mario José Molina-Pasquel Henríquez',
- profession: 'chemist',
- accomplishment: 'discovery of Arctic ozone hole',
- imageId: 'mynHUSa'
-}, {
- id: 2,
- name: 'Mohammad Abdus Salam',
- profession: 'physicist',
- accomplishment: 'electromagnetism theory',
- imageId: 'bE7W1ji'
-}, {
- id: 3,
- name: 'Percy Lavon Julian',
- profession: 'chemist',
- accomplishment: 'pioneering cortisone drugs, steroids and birth control pills',
- imageId: 'IOjWm71'
-}, {
- id: 4,
- name: 'Subrahmanyan Chandrasekhar',
- profession: 'astrophysicist',
- accomplishment: 'white dwarf star mass calculations',
- imageId: 'lrWQx8l'
-}];
-```
-
-```js src/utils.js
-export function getImageUrl(person) {
- return (
- 'https://i.imgur.com/' +
- person.imageId +
- 's.jpg'
- );
-}
-```
-
-```css
-ul { list-style-type: none; padding: 0px 10px; }
-li {
- margin-bottom: 10px;
- display: grid;
- grid-template-columns: 1fr 1fr;
- align-items: center;
-}
-img { width: 100px; height: 100px; border-radius: 50%; }
-h1 { font-size: 22px; }
-h2 { font-size: 20px; }
-```
-
-
-
-