File tree Expand file tree Collapse file tree 5 files changed +60
-39
lines changed
Expand file tree Collapse file tree 5 files changed +60
-39
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ export const Sales: React.FC = () => {
1010 < span className = "text-white font-inter text-2xl" >
1111 Vendas por dia da semana
1212 </ span >
13- < div className = "grid grid-cols-2 pt-8" >
14- < div className = "flex flex-col gap-2" >
13+ < div className = "grid sm: grid-cols-2 grid-cols-1 pt-8" >
14+ < div className = "flex flex-col gap-2 sm:justify-center sm:items-start items-center " >
1515 < InfoOfTheDay
1616 dailySale = "Dia com mais vendas"
1717 weekday = "quarta-feira"
@@ -27,7 +27,7 @@ export const Sales: React.FC = () => {
2727 />
2828 </ div >
2929
30- < div >
30+ < div className = "pt-10" >
3131 < SimpleGraph />
3232 </ div >
3333 </ div >
Original file line number Diff line number Diff line change 1- import classNames from "classnames" ;
2-
31interface IDaysType {
42 day : string ;
53 value : number ;
@@ -47,8 +45,10 @@ export const SimpleGraph: React.FC = () => {
4745 } ;
4846
4947 return (
50- < div className = "h-full" >
51- < div className = "flex justify-between items-end h-full" >
48+ < div className = "relative h-full flex items-center" >
49+ < div className = "w-full bg-[#4A4556] h-[3px]" />
50+
51+ < div className = "absolute flex justify-between items-end h-full overflow-auto z-10 inset-0" >
5252 { DAYS . map ( ( item ) => {
5353 const value = calcularValor ( item . value ) ;
5454
@@ -62,10 +62,7 @@ export const SimpleGraph: React.FC = () => {
6262 className = "flex flex-col justify-center items-center"
6363 >
6464 < div
65- className = { classNames (
66- // height,
67- "bg-custom-cyan-600 w-[15px] rounded-full"
68- ) }
65+ className = { "bg-custom-cyan-600 w-[15px] rounded-full" }
6966 style = { divStyle }
7067 />
7168 < span className = "font-inter font-medium text-sm text-white" >
Original file line number Diff line number Diff line change @@ -6,12 +6,20 @@ interface IItemProps {
66 title : string ;
77 value : number ;
88 color : string ;
9+ type : "money" | "integer" ;
910}
1011
11- export const ItemStatistics : FC < IItemProps > = ( { title, value, color } ) => {
12+ export const ItemStatistics : FC < IItemProps > = ( {
13+ title,
14+ value,
15+ color,
16+ type,
17+ } ) => {
1218 const valueFormatted = useMemo ( ( ) => {
19+ if ( type === "integer" ) return value ;
20+
1321 return formatterNumbers ( value , 1 ) ;
14- } , [ value ] ) ;
22+ } , [ value , type ] ) ;
1523
1624 return (
1725 < div className = "flex gap-1 text-white font-inter text-sm font-medium" >
Original file line number Diff line number Diff line change @@ -3,21 +3,27 @@ import { Card } from "../Card";
33import { CircleProgress } from "../CircleProgress" ;
44import { ItemStatistics } from "./components/Item" ;
55
6- interface IStatisticsProps {
7- title : string ;
6+ interface IDataType {
87 expected : number ;
98 reached : number ;
9+ type : "money" | "integer" ;
10+ }
11+
12+ interface IStatisticsProps {
13+ title : string ;
14+ data : IDataType ;
1015 backgroundColor : string ;
1116 strokeColor : string ;
1217}
1318
1419export const Statistics : FC < IStatisticsProps > = ( {
1520 title,
16- expected,
17- reached,
21+ data,
1822 backgroundColor,
1923 strokeColor,
2024} ) => {
25+ const { reached, expected, type } = data ;
26+
2127 const percentage = useMemo ( ( ) => {
2228 const value = ( reached / expected ) * 100 ;
2329
@@ -30,7 +36,7 @@ export const Statistics: FC<IStatisticsProps> = ({
3036 < Card >
3137 < div className = "py-7 md:px-12" >
3238 < div className = "flex flex-col items-center justify-between gap-4" >
33- < span className = "font-inter font-semibold text-2xl text-white" >
39+ < span className = "font-inter font-semibold text-2xl text-white flex items-center justify-center " >
3440 { title }
3541 </ span >
3642 < div className = "relative" >
@@ -52,11 +58,13 @@ export const Statistics: FC<IStatisticsProps> = ({
5258 title = "Esperado"
5359 value = { expected }
5460 color = { "bg-custom-purple-700" }
61+ type = { type }
5562 />
5663 < ItemStatistics
5764 title = "Alcançado"
5865 value = { reached }
5966 color = { backgroundColor }
67+ type = { type }
6068 />
6169 </ div >
6270 </ div >
Original file line number Diff line number Diff line change @@ -4,29 +4,37 @@ import { Statistics } from "../components/Statistics";
44
55export const Dashboard = ( ) => {
66 return (
7- < div className = "w-screen w- h-screen bg-custom-purple-800 flex justify-center items-center" >
8- < div className = "container mx-auto px-4 grid grid-cols-1 gap-5" >
9- < div className = "grid sm:grid-cols-1 md:grid-cols-3 gap-5" >
10- < Score />
7+ < div className = "w-screen sm:h-screen h-full p-5 bg-custom-purple-800" >
8+ < div className = "sm:flex sm:justify-center sm:items-center h-full" >
9+ < div className = "container grid-cols-1 mx-auto px-4 grid gap-5 max-w-[1200px]" >
10+ < div className = "grid sm:grid-cols-1 md:grid-cols-3 gap-5 " >
11+ < Score />
1112
12- < Statistics
13- title = "Vendas fechadas"
14- expected = { 100 }
15- reached = { 70 }
16- backgroundColor = { "bg-[#7367F0]" }
17- strokeColor = { "stroke-[#7367F0]" }
18- />
13+ < Statistics
14+ title = "Vendas fechadas"
15+ data = { {
16+ expected : 100 ,
17+ reached : 70 ,
18+ type : "integer" ,
19+ } }
20+ backgroundColor = { "bg-[#7367F0]" }
21+ strokeColor = { "stroke-[#7367F0]" }
22+ />
1923
20- < Statistics
21- title = "Meta mensal"
22- expected = { 70000 }
23- reached = { 63000 }
24- backgroundColor = { "bg-[#A66DE9]" }
25- strokeColor = { "stroke-[#A66DE9]" }
26- />
27- </ div >
28- < div >
29- < Sales />
24+ < Statistics
25+ title = "Meta mensal"
26+ data = { {
27+ expected : 70000 ,
28+ reached : 63000 ,
29+ type : "money" ,
30+ } }
31+ backgroundColor = { "bg-[#A66DE9]" }
32+ strokeColor = { "stroke-[#A66DE9]" }
33+ />
34+ </ div >
35+ < div >
36+ < Sales />
37+ </ div >
3038 </ div >
3139 </ div >
3240 </ div >
You can’t perform that action at this time.
0 commit comments