File tree Expand file tree Collapse file tree 3 files changed +85
-2
lines changed Expand file tree Collapse file tree 3 files changed +85
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Card } from "../Card" ;
2
2
import { IconPolygon } from "../Icons/IconPolygon" ;
3
+ import { SimpleGraph } from "../SimpleGraph" ;
3
4
import { InfoOfTheDay } from "./components/InfoOfTheDay" ;
4
5
5
6
export const Sales : React . FC = ( ) => {
@@ -27,8 +28,7 @@ export const Sales: React.FC = () => {
27
28
</ div >
28
29
29
30
< div >
30
- { /* Graph */ }
31
- GRÁFICO
31
+ < SimpleGraph />
32
32
</ div >
33
33
</ div >
34
34
</ div >
Original file line number Diff line number Diff line change
1
+ import classNames from "classnames" ;
2
+
3
+ interface IDaysType {
4
+ day : string ;
5
+ value : number ;
6
+ }
7
+
8
+ const DAYS : IDaysType [ ] = [
9
+ {
10
+ day : "dom" ,
11
+ value : 2 ,
12
+ } ,
13
+ {
14
+ day : "seg" ,
15
+ value : 5 ,
16
+ } ,
17
+ {
18
+ day : "ter" ,
19
+ value : 4 ,
20
+ } ,
21
+ {
22
+ day : "qua" ,
23
+ value : 6 ,
24
+ } ,
25
+ {
26
+ day : "qui" ,
27
+ value : 5 ,
28
+ } ,
29
+ {
30
+ day : "sex" ,
31
+ value : 4.5 ,
32
+ } ,
33
+ {
34
+ day : "sab" ,
35
+ value : 3 ,
36
+ } ,
37
+ ] ;
38
+
39
+ export const SimpleGraph : React . FC = ( ) => {
40
+ const calcularValor = ( value : number ) => {
41
+ let valueTotal = value * 10 ;
42
+
43
+ if ( valueTotal < 0 ) return 1 ;
44
+ else if ( valueTotal > 140 ) return 140 ;
45
+
46
+ return valueTotal ;
47
+ } ;
48
+
49
+ return (
50
+ < div className = "h-full" >
51
+ < div className = "flex justify-between items-end h-full" >
52
+ { DAYS . map ( ( item ) => {
53
+ const value = calcularValor ( item . value ) ;
54
+
55
+ const divStyle = {
56
+ height : `${ value } px` ,
57
+ } ;
58
+
59
+ return (
60
+ < div
61
+ key = { item . day }
62
+ className = "flex flex-col justify-center items-center"
63
+ >
64
+ < div
65
+ className = { classNames (
66
+ // height,
67
+ "bg-custom-cyan-600 w-[15px] rounded-full"
68
+ ) }
69
+ style = { divStyle }
70
+ />
71
+ < span className = "font-inter font-medium text-sm text-white" >
72
+ { item . day }
73
+ </ span >
74
+ </ div >
75
+ ) ;
76
+ } ) }
77
+ </ div >
78
+ </ div >
79
+ ) ;
80
+ } ;
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ module.exports = {
16
16
green : {
17
17
500 : "#81FBB8" ,
18
18
} ,
19
+ cyan : {
20
+ 600 : "#90F7EC" ,
21
+ } ,
19
22
} ,
20
23
} ,
21
24
fontFamily : {
You can’t perform that action at this time.
0 commit comments