Skip to content

Commit

Permalink
Merge pull request #25 from cesarhenrq/4468-sub-header
Browse files Browse the repository at this point in the history
feat: add SubHeader component
  • Loading branch information
katiene-souza authored Sep 29, 2023
2 parents 4a45a02 + df85966 commit 452982a
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 1 deletion.
31 changes: 31 additions & 0 deletions src/components/SubHeader/Sub.Header.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable testing-library/no-node-access */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { render, screen } from '@testing-library/react';

import SubHeader from './Sub.header';

describe('SubHeader component', () => {
beforeEach(() => {
render(<SubHeader />);
});
it('should text be defined', () => {
const headerTextElement = screen.getByText(
'MAIS DE 12.000 VAGAS DE TECNOLOGIA, REUNIDAS EM UM SÓ LUGAR',
);
const subHeaderTextElement = screen.getByText('Encontre a sua vaga de');
const subHeaderTextElementReact = screen.getByText('react');

(expect as any)(headerTextElement).toBeDefined();
(expect as any)(subHeaderTextElement).toBeDefined();
(expect as any)(subHeaderTextElementReact).toBeDefined();
});

it('should image be defined', () => {
const imgElement = document.querySelector('img') as HTMLImageElement;
(expect as any)(imgElement).toBeDefined();
(expect as any)(imgElement.alt).toContain(
'homem sorrindo, com camisa da arnia e segurando um notebook',
);
});
});
37 changes: 37 additions & 0 deletions src/components/SubHeader/Sub.header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Text from '@components/Text';
import HeaderPerson from '../../assets/HeaderPerson.png';

import * as S from './styles';

const SubHeader = () => {
return (
<S.SubHeader>
<div className="text-container">
<Text
label="MAIS DE 12.000 VAGAS DE TECNOLOGIA, REUNIDAS EM UM SÓ LUGAR"
fontColor="white"
fontSize="medium"
/>
<div className="text-top">
<Text
label={
<p>
Encontre a sua vaga de <b>react</b>
</p>
}
fontColor="yellow"
fontSize="xlarge"
fontWeight="600"
/>
</div>
</div>
<img
src={HeaderPerson}
alt="homem sorrindo, com camisa da arnia e segurando um notebook"
className="header-person"
/>
</S.SubHeader>
);
};

export default SubHeader;
1 change: 1 addition & 0 deletions src/components/SubHeader/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Sub.header';
49 changes: 49 additions & 0 deletions src/components/SubHeader/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import styled from 'styled-components';

export const SubHeader = styled.header`
background-color: var(--purple-dark);
width: 100vw;
display: flex;
justify-content: space-between;
padding: 1.25rem 8.438rem;
align-items: center;
.text-container {
width: 25rem;
}
.text-top {
display: flex;
width: 25rem;
}
b {
color: var(--white);
}
@media (max-width: 78.75rem) {
flex-direction: column;
.text-container {
width: 45rem;
}
.text-top {
width: 45rem;
}
}
@media (max-width: 48.75rem) {
.header-person {
width: 38.75rem;
}
.text-container {
width: 30rem;
text-align: center;
}
.text-top {
width: 30rem;
text-align: center;
}
}
`;
2 changes: 1 addition & 1 deletion src/types/TextProps.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ type TextProps = {
fontSize?: FontSize;
fontWeight?: FontWeight;
fontColor?: FontColor;
label: string;
label: string | React.ReactElement;
fontStyle?: FontStyle;
};
Empty file added test/__mocks__/fileMock.js
Empty file.

0 comments on commit 452982a

Please sign in to comment.