Skip to content

Commit 4888c33

Browse files
Removing unnecessary props Title
1 parent fc22bd4 commit 4888c33

File tree

6 files changed

+31
-30
lines changed

6 files changed

+31
-30
lines changed

components/blog/BlogPostsContainer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ const BlogPostsContainer = ({
3232
<RevealContentContainer>
3333
<div className={styles.blogContainer}>
3434
{heading ? (
35-
<Title blogTitle title={heading} />
35+
<Container>
36+
<Title title={heading} />
37+
</Container>
3638
) : tag ? (
37-
<Title blogTitle title={tagToHeading[tag]} />
39+
<Container>
40+
<Title title={tagToHeading[tag]} />
41+
</Container>
3842
) : null}
3943
{
4044
// put in rows of 3 if more than 3 posts (for swipable cards)

components/snippets/Title.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
import styled from 'styled-components';
22

3-
export const TitleStyle = styled.h2`
4-
${props =>
5-
props.blogTitle &&
6-
`
7-
align-self: flex-start;
8-
margin: ${props.adjustedTitle ? '0 auto 1rem 15rem' : '0 auto 1rem'};
9-
width: 90%;
10-
max-width: 1440px;
11-
min-height: 5rem;
12-
`};
3+
export const StyledTitle = styled.h2`
4+
align-self: flex-start;
5+
margin: '0 auto 1rem';
136
`;
147

15-
const Title = ({ title, blogTitle }) => {
16-
return <TitleStyle blogTitle={blogTitle}>{title}</TitleStyle>;
8+
const Title = ({ title }) => {
9+
return <StyledTitle>{title}</StyledTitle>;
1710
};
1811

1912
export default Title;

pages/blog/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState } from 'react';
22
import BlogPostsContainer from '@/components/blog/BlogPostsContainer';
3+
import Container from '@/components/containers/Container';
34
import SearchBar from '@/components/blog/SearchBar';
45
import Title from '@/components/snippets/Title';
56
import styles from '@/styles/Blog.module.scss';
@@ -27,10 +28,13 @@ export default function Blog({ posts }) {
2728

2829
return (
2930
<>
30-
<div className={styles.blogSearch}>
31-
<Title blogTitle title={!searchTerm && 'Latest Posts'} />
32-
<SearchBar setSearchTerm={setSearchTerm} />
33-
</div>
31+
<Container>
32+
<div className={styles.blogSearch}>
33+
<Title blogTitle title={!searchTerm && 'Latest Posts'} />
34+
<SearchBar setSearchTerm={setSearchTerm} />
35+
</div>
36+
</Container>
37+
3438
<BlogPostsContainer {...filteredData} />
3539
{!searchTerm &&
3640
Object.keys(tagToHeading).map(tag => (

styles/Blog.module.scss

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@
2323

2424
.blogSearch {
2525
display: flex;
26-
align-items: center;
2726
padding-top: 2.5rem;
28-
margin: 0 auto;
29-
width: 90%;
30-
max-width: $large-desktop-breakpoint;
27+
justify-content: space-between;
28+
flex-direction: column-reverse;
29+
align-items: flex-start;
3130

32-
@include mobile {
33-
flex-direction: column-reverse;
34-
align-items: flex-start;
31+
@include desktop {
32+
align-items: center;
33+
flex-direction: row;
3534
}
3635
}
3736

styles/SearchBar.module.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
.searchBar {
55
display: flex;
66
justify-content: space-between;
7-
width: 19rem;
87
height: 2.5rem;
98
border-radius: 0.5rem;
109
border: 0;
1110
box-shadow: 2px 4px 8px 3px rgba(0, 0, 0, 0.08);
1211
font-size: 1.2rem;
12+
width: 100%;
13+
margin-top: 3rem;
1314

14-
@include mobile {
15-
width: 80%;
16-
margin: 3rem auto;
15+
@include desktop {
16+
width: 24rem;
17+
margin: unset;
1718
}
1819

1920
input[type='search'] {

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,7 @@ strip-indent@^1.0.1:
35763576
dependencies:
35773577
get-stdin "^4.0.1"
35783578

3579-
styled-components@^5.3.6:
3579+
styled-components@^5, styled-components@^5.3.6:
35803580
version "5.3.6"
35813581
resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.3.6.tgz#27753c8c27c650bee9358e343fc927966bfd00d1"
35823582
integrity sha512-hGTZquGAaTqhGWldX7hhfzjnIYBZ0IXQXkCYdvF1Sq3DsUaLx6+NTHC5Jj1ooM2F68sBiVz3lvhfwQs/S3l6qg==

0 commit comments

Comments
 (0)