generated from muratkeremozcan/react-cypress-ts-vite-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from cesarhenrq/qa
1120 feat chart
- Loading branch information
Showing
21 changed files
with
662 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* eslint-disable indent */ | ||
import { BarChart, Bar, ResponsiveContainer, XAxis, YAxis } from 'recharts'; | ||
|
||
import Text from '@components/Text'; | ||
|
||
import * as S from './styles'; | ||
|
||
type RoundedTopBarProps = { | ||
fill?: string; | ||
x?: number; | ||
y?: number; | ||
width?: number; | ||
height?: number; | ||
}; | ||
|
||
const RoundedTopBar = (props: RoundedTopBarProps) => { | ||
const { fill, x, y, width, height } = props; | ||
const borderRadius = 5; | ||
|
||
return ( | ||
<path | ||
d={`M${x},${(y as number) + (height as number)} | ||
L${x},${(y as number) + borderRadius} | ||
Q${x},${y} ${(x as number) + borderRadius},${y} | ||
L${(x as number) + (width as number) - borderRadius},${y} | ||
Q${(x as number as number) + (width as number)},${y} ${ | ||
(x as number) + (width as number) | ||
},${(y as number) + borderRadius} | ||
L${(x as number) + (width as number)},${ | ||
(y as number) + (height as number) | ||
} | ||
Z`} | ||
stroke="none" | ||
fill={fill} | ||
/> | ||
); | ||
}; | ||
|
||
type Data = { | ||
name: string; | ||
qtd: number; | ||
}; | ||
|
||
type ChartProps = { | ||
data: Data[]; | ||
label: React.ReactElement; | ||
}; | ||
|
||
const Chart = ({ data, label }: ChartProps) => { | ||
return ( | ||
<S.Chart> | ||
<Text label={label} /> | ||
<ResponsiveContainer width="100%" height="100%"> | ||
<BarChart width={150} height={40} data={data} margin={{ top: 24 }}> | ||
<XAxis | ||
dataKey="name" | ||
axisLine={false} | ||
tickLine={false} | ||
allowDataOverflow | ||
/> | ||
<YAxis axisLine={false} tickLine={false} allowDataOverflow /> | ||
<Bar | ||
dataKey="qtd" | ||
fill="#6950A1" | ||
barSize={20} | ||
shape={<RoundedTopBar />} | ||
/> | ||
</BarChart> | ||
</ResponsiveContainer> | ||
</S.Chart> | ||
); | ||
}; | ||
|
||
export default Chart; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './Chart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Chart = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
padding: 1.5rem 0rem; | ||
width: 50%; | ||
height: 269px; | ||
background: #f3f3f3; | ||
border-radius: 16px; | ||
border: 1px #ecf1f4 solid; | ||
.text { | ||
justify-content: flex-start; | ||
margin-left: 2rem; | ||
span { | ||
span { | ||
color: var(--purple-dark-secondary); | ||
} | ||
} | ||
} | ||
tspan { | ||
font-size: 12px; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import { render, screen } from '@testing-library/react'; | ||
import { expect } from '@jest/globals'; | ||
import VacancyInfoCard from './VacancyInfoCard'; | ||
|
||
describe('VancancyCard component', () => { | ||
let container: HTMLElement; | ||
|
||
beforeEach(() => { | ||
container = render( | ||
<VacancyInfoCard | ||
location={'Betim-MG'} | ||
company={'Izap'} | ||
vacancyDescription={'Lorem Ipsum is simply a dummy text'} | ||
vacancyRole={'Desenvolvedor Front-end'} | ||
vacancyType={'Home Office'} | ||
wage={'4000'} | ||
technologies={['React', 'PHP', 'Java']} | ||
advertiser={'Marcos'} | ||
createdAt={'12/10/2023'} | ||
/>, | ||
).container; | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(container).toBeDefined(); | ||
}); | ||
it('to be render location', () => { | ||
const location = screen.getByText('Betim-MG'); | ||
(expect as any)(location).toBeInTheDocument(); | ||
}); | ||
it('to be render vacancyRole', () => { | ||
const vacancyRole = screen.getByText('Desenvolvedor Front-end'); | ||
(expect as any)(vacancyRole).toBeInTheDocument(); | ||
}); | ||
it('to be render vacancyType', () => { | ||
const vacancyType = screen.getByText('Home Office'); | ||
(expect as any)(vacancyType).toBeInTheDocument(); | ||
}); | ||
it('to be render advertiser', () => { | ||
const advertiser = screen.getByText('Marcos'); | ||
(expect as any)(advertiser).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.