Skip to content

Commit

Permalink
Merge pull request #94 from cesarhenrq/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
katiene-souza authored Oct 17, 2023
2 parents 4ae728e + f9ef5a3 commit 0640b28
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/components/SaveSearches/SaveSearches.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { render, screen } from '@testing-library/react';
import { expect } from '@jest/globals';
import SaveSearches from './SaveSearches';

describe('SaveSearches component', () => {
let container: HTMLElement;

beforeEach(() => {
container = render(<SaveSearches />).container;
});

it('should be defined', () => {
expect(container).toBeDefined();
});

it('to be render SaveButton', () => {
screen.getByText('Salvar busca');
});
});
32 changes: 32 additions & 0 deletions src/components/SaveSearches/SaveSearches.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Text from '@components/Text';
import * as S from './styles';
import * as I from '@assets/db.icons';

const SaveSearches = () => {
return (
<S.Container>
<Text
label={
<p>
Salve essa busca, te <b>avisaremos por e-mail</b> quando
encontrarmos mais vagas
</p>
}
fontSize="medium"
fontColor="white"
/>

<S.Button>
<I.Save fill="yellow" width={24} />
<Text
label="Salvar busca"
fontSize="normal"
fontColor="white"
fontWeight="500"
/>
</S.Button>
</S.Container>
);
};

export default SaveSearches;
1 change: 1 addition & 0 deletions src/components/SaveSearches/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './SaveSearches';
25 changes: 25 additions & 0 deletions src/components/SaveSearches/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* eslint-disable indent */
import styled from 'styled-components';

export const Container = styled.section`
display: flex;
gap: 1.5rem;
padding-top: 2.5rem;
b {
font-weight: bold;
font-style: italic;
}
.text {
justify-content: flex-start;
}
`;

export const Button = styled.button`
display: flex;
gap: 0.5rem;
background-color: var(--purple-dark-secondary);
border-radius: 0.5rem;
padding: 0.5rem 0.625rem;
`;
6 changes: 6 additions & 0 deletions src/components/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import Button from './../Button';
import useField from '@hooks/useField';
import useRecentSearches from '@hooks/useRecentSearches';
import useSearchHandling from '@hooks/useSearchHandling';
import SaveSearches from '@components/SaveSearches';

import * as S from './styles';
import { useContext } from 'react';
import { userContext } from '@contexts/user';

const SearchBar = () => {
const [location] = useField('text', 'location');
Expand All @@ -18,6 +21,8 @@ const SearchBar = () => {

const [recentSearches, addRecentSearch] = useRecentSearches();

const { user } = useContext(userContext);

const handleSearch = useSearchHandling(
positionOrTech.value,
location.value,
Expand Down Expand Up @@ -102,6 +107,7 @@ const SearchBar = () => {
</div>
</div>
)}
{user && pathname === '/vacancies' && <SaveSearches />}
</S.Container>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/components/VacanciesFound/VacanciesFound.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { render, screen } from '@testing-library/react';
import { expect } from '@jest/globals';
import VacanciesFound from './VacanciesFound';
Expand Down

0 comments on commit 0640b28

Please sign in to comment.