Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1121 save searches #93

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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