Skip to content

Commit 67273b5

Browse files
authored
Merge pull request #191 from padmajabhol/gsoc22
modularise layout
2 parents b2beaf4 + 19ce89c commit 67273b5

File tree

14 files changed

+113
-95
lines changed

14 files changed

+113
-95
lines changed

data/db.json

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -223,54 +223,6 @@
223223
"datashared": false,
224224
"peerreview": true,
225225
"enforced": "Yes - before application"
226-
},
227-
{
228-
"title": "DD",
229-
"authors": "DDD",
230-
"journaltype": "DD",
231-
"topic": "D",
232-
"published": "August 20, 02022 1:58:04 PM",
233-
"issn": "ISSN",
234-
"link": "D",
235-
"policy": "policy 3",
236-
"dataavail": false,
237-
"datashared": false,
238-
"peerreview": false,
239-
"enforced": "option 2",
240-
"evidence": "ENF",
241-
"id": 15
242-
},
243-
{
244-
"title": "EE",
245-
"authors": "Q",
246-
"journaltype": "EE",
247-
"topic": "J",
248-
"published": "August 20, 02022 2:05:57 PM",
249-
"issn": "W",
250-
"link": "J",
251-
"policy": "policy 1",
252-
"dataavail": true,
253-
"datashared": false,
254-
"peerreview": false,
255-
"enforced": "",
256-
"evidence": "W",
257-
"id": 16
258-
},
259-
{
260-
"title": "B",
261-
"authors": "dqwdqw",
262-
"journaltype": "DSWd",
263-
"topic": "dqw",
264-
"published": "August 20, 02022 2:07:39 PM",
265-
"issn": "wdwq",
266-
"link": "dqwdqw",
267-
"policy": "policy 1",
268-
"dataavail": true,
269-
"datashared": false,
270-
"peerreview": false,
271-
"enforced": "",
272-
"evidence": "dqwdqw",
273-
"id": 17
274226
}
275227
]
276228
}

src/App.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import { BrowserRouter as Router, Switch, Route, Redirect, useHistory } from 're
1010
import { format } from 'date-fns';
1111
import { api } from './api/posts';
1212
import { Journal, Contact, Manifesto, Home } from './pages';
13-
import { Footer, Auth, Header, Login, JournalDetails, AddJournal } from './components';
13+
import { Footer, Auth, Header, Login, JournalDetails, AddJournal, Layout } from './components';
1414
import Navbar from './components/marginals/Navbar/Navbar';
1515
import Edit from './components/EditJournal/Edit';
1616
import useAxiosFetch from './hooks/useAxiosFetch';
1717
import { DataProvider } from './context/DataContext';
1818

1919
function App() {
2020
return (
21-
<div className='App'>
21+
<Layout>
2222
<DataProvider>
2323
<Switch>
2424
<Route exact path='/'>
@@ -47,10 +47,9 @@ function App() {
4747
</Route>
4848
<Redirect to='/' />
4949
</Switch>
50-
<Navbar />
5150
<Footer />
5251
</DataProvider>
53-
</div>
52+
</Layout>
5453
);
5554
}
5655

src/components/AddJournal/AddJournal.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
Container,
1414
Head,
1515
Label,
16-
PolicyContainer,
1716
Toggle,
1817
Input,
1918
FirstDiv,
@@ -28,6 +27,7 @@ import {
2827
} from './styles';
2928
import { FormInputBtn } from '../Authentication/styles';
3029
import { useGlobalContext } from '../../context/DataContext';
30+
import { SectionLayout, PolicyContainer } from '../marginals';
3131

3232
const AddJournal = () => {
3333
const {
@@ -51,7 +51,7 @@ const AddJournal = () => {
5151
dispatch,
5252
} = useGlobalContext();
5353
return (
54-
<Container>
54+
<SectionLayout>
5555
<PolicyContainer>
5656
<Head>Create Journal Policies</Head>
5757
<Form onSubmit={handleSubmit}>
@@ -270,7 +270,7 @@ const AddJournal = () => {
270270
{isPending && <FormInputBtn>Adding blog...</FormInputBtn>}
271271
</Form>
272272
</PolicyContainer>
273-
</Container>
273+
</SectionLayout>
274274
);
275275
};
276276

src/components/AddJournal/styles.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const Container = styled.div`
1111
export const Head = styled.h1`
1212
font-size: 1.8rem;
1313
color: #ec8d20;
14-
// text-align: center;
1514
`;
1615

1716
export const PolicyContainer = styled.div`

src/components/EditJournal/Edit.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
88
import { faBookmark } from '@fortawesome/free-solid-svg-icons';
99
import Switch from 'react-switch';
1010
import {
11-
Container,
1211
Head,
1312
Label,
14-
PolicyContainer,
1513
Toggle,
1614
Input,
1715
FirstDiv,
@@ -26,6 +24,7 @@ import {
2624
} from '../AddJournal/styles';
2725
import { FormInputBtn } from '../Authentication/styles';
2826
import { useGlobalContext } from '../../context/DataContext';
27+
import { SectionLayout, PolicyContainer } from '../marginals';
2928

3029
const Edit = () => {
3130
const {
@@ -101,7 +100,7 @@ const Edit = () => {
101100
}, [dispatch, post]);
102101

103102
return (
104-
<Container>
103+
<SectionLayout>
105104
<PolicyContainer>
106105
{editTitle && (
107106
<>
@@ -341,7 +340,7 @@ const Edit = () => {
341340
</>
342341
)}
343342
</PolicyContainer>
344-
</Container>
343+
</SectionLayout>
345344
);
346345
};
347346

src/components/JournalDetails/Details.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ import {
1616
} from '@fortawesome/free-solid-svg-icons';
1717
import useFetch from '../Journals/useFetch';
1818
import {
19-
Container,
2019
Head,
21-
PolicyContainer,
2220
Title,
2321
Subhead,
2422
Subhead2,
@@ -33,6 +31,7 @@ import {
3331
import { Authors, Head3 } from '../Journals/styles';
3432
import { FormInputBtn } from '../Authentication/styles';
3533
import { useGlobalContext } from '../../context/DataContext';
34+
import { SectionLayout, PolicyContainer } from '../marginals';
3635

3736
function Details() {
3837
const { posts, handleDelete } = useGlobalContext();
@@ -97,7 +96,7 @@ function Details() {
9796
];
9897

9998
return (
100-
<Container>
99+
<SectionLayout>
101100
<Head>Journal policies</Head>
102101
{indv && (
103102
<PolicyContainer>
@@ -149,7 +148,7 @@ function Details() {
149148
</p>
150149
</>
151150
)}
152-
</Container>
151+
</SectionLayout>
153152
);
154153
}
155154

src/components/JournalDetails/styles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const Container = styled.div`
99
`;
1010

1111
export const Head = styled.h1`
12-
margin-top: 100px;
1312
font-size: 2rem;
1413
color: #ec8d20;
1514
text-align: center;
@@ -19,8 +18,9 @@ export const PolicyContainer = styled.div`
1918
width: 65%;
2019
margin: 0px auto 0px auto;
2120
background-color: #ffff;
22-
padding: 3rem 6rem;
21+
padding: 2rem 3rem;
2322
border: 5px;
23+
border-radius: 8px;
2424
align-self: center;
2525
justify-self: center;
2626
@media (max-width: 1300px) {

src/components/Journals/Journal.js

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,35 @@ import React from 'react';
44
import { FiSearch } from 'react-icons/fi';
55
import JournalList from './JournalList';
66
// import useFetch from './useFetch';
7-
import { JContainer, Head, Search, SearchTerm, SearchButton } from './styles';
7+
import { JContainer, Head, Search, SearchTerm, SearchButton, Container } from './styles';
88

99
const Journal = ({ posts, search, postsPerPage, totalPosts, paginate, dispatch }) => {
1010
return (
11-
<JContainer>
12-
<Head>Journals</Head>
13-
<form onSubmit={(e) => e.preventDefault()}>
14-
<Search>
15-
<SearchTerm
16-
id='search'
17-
type='text'
18-
placeholder='Search Journal'
19-
value={search}
20-
onChange={(e) => dispatch({ type: 'SEARCH', payload: e.target.value })}
21-
/>
22-
{console.log(search)}
23-
<SearchButton type='submit'>
24-
<FiSearch />
25-
</SearchButton>
26-
</Search>
27-
</form>
28-
<JournalList
29-
posts={posts}
30-
postsPerPage={postsPerPage}
31-
totalPosts={totalPosts}
32-
paginate={paginate}
33-
/>
34-
</JContainer>
11+
<Container>
12+
<JContainer>
13+
<Head>Journals</Head>
14+
<form onSubmit={(e) => e.preventDefault()}>
15+
<Search>
16+
<SearchTerm
17+
id='search'
18+
type='text'
19+
placeholder='Search Journal'
20+
value={search}
21+
onChange={(e) => dispatch({ type: 'SEARCH', payload: e.target.value })}
22+
/>
23+
<SearchButton type='submit'>
24+
<FiSearch />
25+
</SearchButton>
26+
</Search>
27+
</form>
28+
<JournalList
29+
posts={posts}
30+
postsPerPage={postsPerPage}
31+
totalPosts={totalPosts}
32+
paginate={paginate}
33+
/>
34+
</JContainer>
35+
</Container>
3536
);
3637
};
3738

src/components/Journals/styles.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ export const JContainer = styled.div`
1010
display: grid;
1111
width: 60%;
1212
margin: 0px auto 0px auto;
13-
// margin-left: 100px;
1413
gap: 10px;
1514
@media (max-width: 1300px) {
1615
width: 70%;
17-
margin-left: 80px;
1816
}
1917
@media (max-width: 1000px) {
2018
width: 70%;
21-
margin-left: 50px;
2219
}
2320
@media (max-width: 700px) {
2421
margin: 0px auto 0px auto;

src/components/marginals/Navbar/styles.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export const MenuLink = styled.a`
2727
`;
2828

2929
export const Nav = styled.div`
30-
padding: 0 2rem;
30+
padding: 0;
31+
z-index: 99;
3132
display: flex;
3233
justify-content: space-between;
3334
align-items: center;

0 commit comments

Comments
 (0)