Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Milestone 10: Add Mission to profile section #34

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ body {
align-items: center;
gap: 25px;
}

.navbar .brand span {
font-size: 25px;
font-weight: 600;
Expand All @@ -51,8 +52,12 @@ body {
text-decoration: none;
}

.rockets-container{
padding: 20px 0px;
.rockets-container {
padding: 20px 0;
}

.profile-container {
margin: 20px;
}

@media screen and (min-width: 800px) {
Expand Down
32 changes: 21 additions & 11 deletions src/components/Profile/profile.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
/* eslint-disable linebreak-style */
/* eslint-disable no-unused-vars */
/* eslint-disable quotes */
import { ListGroup, Col } from "react-bootstrap";
import {
Container, Row, ListGroup, Col,
} from "react-bootstrap";
import { useSelector } from "react-redux";
// import { Row } from "react-bootstrap/Row";

const Profile = () => {
const profileParts = useSelector((state) => [
{
RocketTitle: "My Missions",
data: state.missions.filter((mission) => mission.reserved),
},
{
RocketTitle: "My Rockets",
data: state.rockets.filter((rocket) => rocket.reserved),
},
]);
return (
<>
{profileParts.map(({ RocketTitle, data }) => (
<Col key={RocketTitle}>
<h4>{RocketTitle}</h4>
<ListGroup>
{data.map((item) => (
<ListGroup.Item key={item.id}>{item.name}</ListGroup.Item>
))}
</ListGroup>
</Col>
))}
<Container className="profile-container">
<Row>
{profileParts.map(({ RocketTitle, data }) => (
<Col key={RocketTitle}>
<h4>{RocketTitle}</h4>
<ListGroup>
{data.map((item) => (
<ListGroup.Item key={item.id}>{item.name}</ListGroup.Item>
))}
</ListGroup>
</Col>
))}
</Row>
</Container>
</>
);
};
Expand Down