Skip to content

Commit

Permalink
SH-41 -(JSX)-Renaming components #41
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjguru committed Jul 25, 2022
1 parent 9cc927e commit 211d97c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Header from '../Header/Header';
import ArticleList from '../Article/ArticleList';
import ChapterList from '../Chapter/ChapterList';
import summer_house_logo from '../../assets/summer_house_logo_512.png';
import '../../styles/App.css';
import Branding from '../Branding/Branding';
Expand All @@ -16,7 +16,7 @@ function App() {
<a className="App-link" href="http://summerhouse.ddev.site:8091/Home/" target="_blank" rel="noopener noreferrer">Learn more about Summer House</a>
<br></br><hr></hr>
<br></br>
<ArticleList />
<ChapterList />
</div>
);
}
Expand Down
14 changes: 0 additions & 14 deletions frontend_react/src/components/Article/Article.jsx

This file was deleted.

14 changes: 14 additions & 0 deletions frontend_react/src/components/Chapter/Chapter.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';

const Chapter = (props) => {
const { chapter } = props;
return (
<div>
<div>
{chapter.title} ({chapter.author})
</div>
</div>
);
};

export default Chapter;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Article from './Article';
import Chapter from './Chapter';
import { useQuery, gql } from '@apollo/client';

const MyQuery = gql`
Expand All @@ -15,20 +15,20 @@ const MyQuery = gql`
}
`;

const ArticleList = () => {
const ChapterList = () => {
const { data } = useQuery(MyQuery);

return (
<div>
{data && (
<>
{data.articles.items.map((article) => (
<Article key={article.id} article={article} />
{data.articles.items.map((chapter) => (
<Chapter key={chapter.id} chapter={chapter} />
))}
</>
)}
</div>
);
};

export default ArticleList;
export default ChapterList;

0 comments on commit 211d97c

Please sign in to comment.