Skip to content

Commit df725c2

Browse files
authored
Merge pull request #254 from Web-Dev-Path/refactor/to-scss-SearchBar
Refactor/to scss search bar
2 parents dd1a773 + c6e5cb9 commit df725c2

5 files changed

Lines changed: 48 additions & 47 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
163163
- ButtonLink
164164
- SubmitButton
165165
- AuthorBio
166+
- SearchBar
166167
- BlogPostsContainer
167168
- RevealContentContainer
169+
168170
- Updated ContactUsForm's checkbox wrapper from div to label to enhance its accessibility
171+
- Updated SearchInput width to 100% for better styling
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@use '@/styles/mixins' as *;
2+
3+
.searchBar {
4+
display: flex;
5+
justify-content: space-between;
6+
height: 2.5rem;
7+
border-radius: 0.5rem;
8+
border: 0;
9+
box-shadow: 2px 4px 8px 3px var(--color-box-shadow);
10+
font-size: 1.2rem;
11+
width: 100%;
12+
margin-top: 3rem;
13+
14+
@include desktop {
15+
width: 24rem;
16+
margin: unset;
17+
}
18+
}
19+
20+
.searchInput {
21+
height: 100%;
22+
border: 0;
23+
padding-left: 1rem;
24+
width: 100%;
25+
}
26+
27+
.submitButton {
28+
text-indent: -999px;
29+
overflow: hidden;
30+
width: 1.5rem;
31+
border: 1px solid var(--color-transparent);
32+
background: url('/images/svg/search.svg');
33+
background-size: cover;
34+
background-repeat: no-repeat;
35+
margin: 0.5rem 1rem 0.5rem 1rem;
36+
cursor: pointer;
37+
}

components/blog/SearchBar/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import S from './styles';
1+
import styles from './SearchBar.module.scss';
22
import { useRef } from 'react';
33

44
const SearchBar = ({ setSearchTerm }) => {
@@ -7,17 +7,18 @@ const SearchBar = ({ setSearchTerm }) => {
77
setSearchTerm(searchInput.current.value);
88
};
99
return (
10-
<S.SearchBar>
11-
<S.SearchInput
10+
<div className={styles.searchBar}>
11+
<input
1212
ref={searchInput}
13+
className={styles.searchInput}
1314
type='search'
1415
placeholder='keyword or topic'
1516
onChange={search}
1617
/>
17-
<S.SubmitButton type='submit' onClick={search}>
18+
<button type='submit' className={styles.submitButton} onClick={search}>
1819
Search
19-
</S.SubmitButton>
20-
</S.SearchBar>
20+
</button>
21+
</div>
2122
);
2223
};
2324

components/blog/SearchBar/styles.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

styles/themes.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
--color-white: #ffffff;
77
--color-primary-content: #292929;
88
--color-transparent: transparent;
9+
--color-box-shadow: rgba(0, 0, 0, 0.08);
910
--dark-bg: #023047;
1011
--error: #be1313;
1112
}

0 commit comments

Comments
 (0)