mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-12 13:36:43 +00:00
connect developers profile to store
This commit is contained in:
parent
cf120854ee
commit
cb716e9f17
3 changed files with 54 additions and 41 deletions
|
|
@ -26,7 +26,7 @@ const DevProfile: FC<DevSummary> = ({
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
{skills.map((s, i) => (
|
{skills?.map((s, i) => (
|
||||||
<li className="text-primary" key={i}>
|
<li className="text-primary" key={i}>
|
||||||
<FontAwesomeIcon icon={faCheck} /> {s}
|
<FontAwesomeIcon icon={faCheck} /> {s}
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -146,4 +146,27 @@ export const dummyDev: Dev = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** dummy devSummary profiles for debug and development only */
|
||||||
|
export const developers: DevSummary[] = [
|
||||||
|
{
|
||||||
|
id: '0',
|
||||||
|
displayName: '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',
|
||||||
|
displayName: 'Ruidy Nemausat',
|
||||||
|
picture:
|
||||||
|
'https://lh3.googleusercontent.com/a-/AOh14GhncH95MWKwPR3TRKy4eVd4n6w0-fobe4dhiam2xA',
|
||||||
|
description: 'Fullstack Engineer at DESY',
|
||||||
|
location: 'Hamburg, DE',
|
||||||
|
skills: ['React', 'TypeScript', 'Redux', 'Nodejs'],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
export default Dev;
|
export default Dev;
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,21 @@
|
||||||
import React, {FC} from 'react';
|
import React, {FC} from 'react';
|
||||||
|
// Redux
|
||||||
|
import {compose} from 'redux';
|
||||||
|
import {connect} from 'react-redux';
|
||||||
|
import {firestoreConnect} from 'react-redux-firebase';
|
||||||
|
import {RootState} from '../store';
|
||||||
|
// Style
|
||||||
import Header from '../components/Header';
|
import Header from '../components/Header';
|
||||||
import DevProfile from '../components/DevProfile';
|
import DevProfile from '../components/DevProfile';
|
||||||
import {DevSummary} from '../models/Dev';
|
import {DevSummary} from '../models/Dev';
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
developers: DevSummary[];
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Developers list page
|
* Developers list page
|
||||||
*/
|
*/
|
||||||
// const Developers: FC<DevSummary[]> = (developers) => {
|
const Developers: FC<IProps> = ({developers}) => (
|
||||||
const Developers: FC = () => {
|
|
||||||
const developers: DevSummary[] = [
|
|
||||||
{
|
|
||||||
id: '0',
|
|
||||||
displayName: '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',
|
|
||||||
displayName: 'Ruidy Nemausat',
|
|
||||||
picture:
|
|
||||||
'https://lh3.googleusercontent.com/a-/AOh14GhncH95MWKwPR3TRKy4eVd4n6w0-fobe4dhiam2xA',
|
|
||||||
description: 'Fullstack Engineer at DESY',
|
|
||||||
location: 'Hamburg, DE',
|
|
||||||
skills: ['React', 'TypeScript', 'Redux', 'Nodejs'],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<section className="container">
|
<section className="container">
|
||||||
<Header
|
<Header
|
||||||
title="Developers"
|
title="Developers"
|
||||||
|
|
@ -37,13 +23,17 @@ const Developers: FC = () => {
|
||||||
icon="connectdevelop"
|
icon="connectdevelop"
|
||||||
/>
|
/>
|
||||||
<div className="profiles">
|
<div className="profiles">
|
||||||
{developers.map(dev => (
|
{developers?.map(dev => (
|
||||||
// use spread operator to pass props
|
// use spread operator to pass props
|
||||||
<DevProfile key={dev.id} {...dev} />
|
<DevProfile key={dev.id} {...dev} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
export default Developers;
|
export default compose<FC>(
|
||||||
|
firestoreConnect(() => ['users']), // or { collection: 'users' }
|
||||||
|
connect((state: RootState, props) => ({
|
||||||
|
developers: state.firestore.ordered.users,
|
||||||
|
})),
|
||||||
|
)(Developers);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue