File tree Expand file tree Collapse file tree 5 files changed +167
-1
lines changed Expand file tree Collapse file tree 5 files changed +167
-1
lines changed Original file line number Diff line number Diff line change 1+ interface IconPolygonProps extends React . ComponentPropsWithoutRef < "svg" > { }
2+
3+ export const IconPolygon = ( props : IconPolygonProps ) => (
4+ < svg
5+ width = { 13 }
6+ height = { 12 }
7+ viewBox = "0 0 13 12"
8+ fill = "none"
9+ xmlns = "http://www.w3.org/2000/svg"
10+ { ...props }
11+ >
12+ < path d = "M6.5.5l6.495 11.25H.005L6.5.5z" fill = "currentColor" />
13+ < defs >
14+ < linearGradient
15+ id = "paint0_linear_201_16"
16+ x1 = { 6.5 }
17+ y1 = { 0.5 }
18+ x2 = { 6.5 }
19+ y2 = { 15.5 }
20+ gradientUnits = "userSpaceOnUse"
21+ >
22+ < stop stopColor = "currentColor" />
23+ < stop offset = { 1 } stopColor = "currentColor" />
24+ </ linearGradient >
25+ </ defs >
26+ </ svg >
27+ ) ;
Original file line number Diff line number Diff line change 1+ import { ReactNode } from "react" ;
2+
3+ interface IInfoOfTheDayProps {
4+ icon : ReactNode ;
5+ dailySale : string ;
6+ weekday : string ;
7+ }
8+
9+ export const InfoOfTheDay : React . FC < IInfoOfTheDayProps > = ( {
10+ icon,
11+ dailySale,
12+ weekday,
13+ } ) => {
14+ return (
15+ < >
16+ < div className = "flex items-center gap-1" >
17+ { icon }
18+ < span className = "text-white font-inter text-sm font-medium" >
19+ { dailySale }
20+ </ span >
21+ </ div >
22+
23+ < span className = "text-white font-inter text-2xl font-medium" >
24+ { weekday }
25+ </ span >
26+ </ >
27+ ) ;
28+ } ;
Original file line number Diff line number Diff line change 11import { Card } from "../Card" ;
2+ import { IconPolygon } from "../Icons/IconPolygon" ;
3+ import { SimpleGraph } from "../SimpleGraph" ;
4+ import { InfoOfTheDay } from "./components/InfoOfTheDay" ;
25
36export const Sales : React . FC = ( ) => {
47 return (
58 < Card >
6- < span className = "text-white" > Vendas por dia da semana</ span >
9+ < div className = "px-12 py-7" >
10+ < span className = "text-white font-inter text-2xl" >
11+ Vendas por dia da semana
12+ </ span >
13+ < div className = "grid grid-cols-2 pt-8" >
14+ < div className = "flex flex-col gap-2" >
15+ < InfoOfTheDay
16+ dailySale = "Dia com mais vendas"
17+ weekday = "quarta-feira"
18+ icon = { < IconPolygon className = "text-green-700 shadow-sm" /> }
19+ />
20+ < div className = "pt-7" />
21+ < InfoOfTheDay
22+ dailySale = "Dia com menos vendas"
23+ weekday = "domingo"
24+ icon = {
25+ < IconPolygon className = "text-red-700 rotate-180 shadow-sm" />
26+ }
27+ />
28+ </ div >
29+
30+ < div >
31+ < SimpleGraph />
32+ </ div >
33+ </ div >
34+ </ div >
735 </ Card >
836 ) ;
937} ;
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 = {
1616 green : {
1717 500 : "#81FBB8" ,
1818 } ,
19+ cyan : {
20+ 600 : "#90F7EC" ,
21+ } ,
1922 } ,
2023 } ,
2124 fontFamily : {
You can’t perform that action at this time.
0 commit comments