mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-12 13:36:43 +00:00
extract DevSummary type
This commit is contained in:
parent
e103c8a354
commit
1a16800e1e
3 changed files with 38 additions and 23 deletions
|
|
@ -1,21 +1,18 @@
|
|||
import React, {FC} from 'react';
|
||||
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
||||
import {faCheck} from '@fortawesome/free-solid-svg-icons';
|
||||
import DevSummary from '../models/DevSummary';
|
||||
|
||||
interface IProps {
|
||||
name: string;
|
||||
description: string;
|
||||
location: string;
|
||||
skills: string[];
|
||||
}
|
||||
|
||||
const DevProfile: FC<IProps> = ({name, description, location, skills}) => (
|
||||
const DevProfile: FC<DevSummary> = ({
|
||||
id,
|
||||
name,
|
||||
picture,
|
||||
description,
|
||||
location,
|
||||
skills,
|
||||
}) => (
|
||||
<div className="profile bg-light">
|
||||
<img
|
||||
src="https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200"
|
||||
alt="Some guy"
|
||||
className="round-img"
|
||||
/>
|
||||
<img src={picture} alt={name} className="round-img" />
|
||||
<div>
|
||||
<h2>{name}</h2>
|
||||
<p>{description}</p>
|
||||
|
|
|
|||
10
src/models/DevSummary.ts
Normal file
10
src/models/DevSummary.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
interface DevSummary {
|
||||
id: string;
|
||||
name: string;
|
||||
picture: string;
|
||||
description: string;
|
||||
location: string;
|
||||
skills: string[];
|
||||
}
|
||||
|
||||
export default DevSummary;
|
||||
|
|
@ -1,20 +1,33 @@
|
|||
import React, {FC} from 'react';
|
||||
import Header from '../components/Header';
|
||||
import DevProfile from '../components/DevProfile';
|
||||
import DevSummary from '../models/DevSummary';
|
||||
|
||||
// interface IProps {
|
||||
// developers: []
|
||||
// developers: DevSummary[]
|
||||
// }
|
||||
|
||||
// const Developers: FC<IProps> = ({developers}) => (
|
||||
const Developers: FC = () => {
|
||||
const developers = [
|
||||
const developers: DevSummary[] = [
|
||||
{
|
||||
id: '0',
|
||||
name: 'John Doe',
|
||||
picture:
|
||||
'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200',
|
||||
description: 'Developer at Microsoft',
|
||||
location: 'Seattle, WA',
|
||||
skills: ['HTML', 'CSS', 'JavaScript', 'Python'],
|
||||
},
|
||||
{
|
||||
id: '42',
|
||||
name: 'Ruidy Nemausat',
|
||||
picture:
|
||||
'https://lh3.googleusercontent.com/a-/AOh14GhncH95MWKwPR3TRKy4eVd4n6w0-fobe4dhiam2xA',
|
||||
description: 'Frontend Engineer at DESY',
|
||||
location: 'Hamburg, DE',
|
||||
skills: ['React', 'TypeScript', 'Redux', 'GraphQL'],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
@ -25,14 +38,9 @@ const Developers: FC = () => {
|
|||
icon="connectdevelop"
|
||||
/>
|
||||
<div className="profiles">
|
||||
{developers.map((dev, i) => (
|
||||
<DevProfile
|
||||
key={i}
|
||||
name={dev.name}
|
||||
description={dev.description}
|
||||
location={dev.location}
|
||||
skills={dev.skills}
|
||||
/>
|
||||
{developers.map(dev => (
|
||||
// use spread operator to pass props
|
||||
<DevProfile key={dev.id} {...dev} />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Reference in a new issue