File tree Expand file tree Collapse file tree 5 files changed +278
-46
lines changed Expand file tree Collapse file tree 5 files changed +278
-46
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,12 @@ FROM node:20.12.2
2
2
3
3
WORKDIR /app
4
4
5
- USER node
6
-
7
5
COPY --chown=node:node . .
8
6
9
7
RUN npm install
10
8
9
+ USER node
10
+
11
11
EXPOSE 3000
12
12
13
- CMD ["npm" , "run" , "dev" ]
13
+ CMD ["npm" , "run" , "dev" ]
Original file line number Diff line number Diff line change
1
+ import styled from "styled-components" ;
2
+
3
+ export const PopupContent = styled . div `
4
+ display: flex;
5
+ flex-direction: column;
6
+ padding: 0.5rem;
7
+ gap: 0.2rem;
8
+ background-color: white;
9
+ border-radius: 8px;
10
+ color: black;
11
+ width: 12rem;
12
+ ` ;
13
+
14
+ export const Title = styled . h3 `
15
+ font-weight: bold;
16
+ font-size: 1.1rem;
17
+ ` ;
18
+
19
+ export const Subtitle = styled . h4 `
20
+ font-size: 0.8rem;
21
+ opacity: 0.7;
22
+ ` ;
23
+
24
+ export const TopHeader = styled . div `
25
+ display: flex;
26
+ flex-direction: column;
27
+ justify-content: space-between;
28
+ margin-bottom: 0.5rem;
29
+ ` ;
30
+
31
+ export const LineInfo = styled . div `
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 0.5rem;
35
+ width: 100%;
36
+ ` ;
37
+
38
+ export const TotalArea = styled . h3 `
39
+ font-size: 1rem;
40
+ width: 6.5rem;
41
+ ` ;
42
+
43
+ export const PercentArea = styled . h3 `
44
+ font-size: 1rem;
45
+ font-weight: bold;
46
+ text-align: right;
47
+ margin-left: auto; /* Isso alinha o PercentArea à extrema direita */
48
+ width: 2rem;
49
+ ` ;
50
+
51
+ export const Color = styled . div < { color : string ; $percent : number } > `
52
+ width: ${ ( { $percent } ) => `${ $percent / 30 } rem` } ;
53
+ max-width: 100%;
54
+ height: 1.25rem;
55
+ border-radius: 4px;
56
+ background-color: ${ ( { color } ) => color } ;
57
+ box-shadow: 0px 0px 4px #cdcdcd;
58
+ transition: 400ms;
59
+ border: solid thin #cdcdcd;
60
+ margin-left: 0;
61
+ ` ;
Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ import {
3
+ PopupContent ,
4
+ TopHeader ,
5
+ Title ,
6
+ Subtitle ,
7
+ LineInfo ,
8
+ TotalArea ,
9
+ PercentArea ,
10
+ Color ,
11
+ } from "./MapPopup.styles" ; // Estilos importados
12
+
13
+ interface AreaInfo {
14
+ color : string ;
15
+ area : string ;
16
+ percent : number ;
17
+ }
18
+
19
+ interface MapPopupProps {
20
+ nameUF : string ;
21
+ colors : string [ ] ;
22
+ nameRaster : string ;
23
+ fcMetadata : any ;
24
+ }
25
+
26
+ const MapPopup : React . FC < MapPopupProps > = ( {
27
+ nameUF,
28
+ colors,
29
+ nameRaster,
30
+ fcMetadata,
31
+ } ) => {
32
+ const areas = Array . from ( { length : 6 } , ( _ , index ) => ( {
33
+ area : fcMetadata [ `Area_km2_${ index + 1 } ` ] ,
34
+ color : colors [ index ] ,
35
+ percent : fcMetadata [ `Percent_${ index + 1 } ` ] ,
36
+ } ) )
37
+ . filter ( ( { percent } ) => percent > 0 )
38
+ . map ( ( areaInfo ) => {
39
+ const formattedArea =
40
+ areaInfo . area > 1000
41
+ ? `${ ( areaInfo . area / 1000 ) . toFixed ( 1 ) } Mil Km²`
42
+ : `${ areaInfo . area . toFixed ( 0 ) } Km²` ;
43
+
44
+ return {
45
+ color : areaInfo . color ,
46
+ area : formattedArea ,
47
+ percent : areaInfo . percent . toFixed ( 0 ) ,
48
+ } ;
49
+ } ) ;
50
+
51
+ return (
52
+ < PopupContent >
53
+ < TopHeader >
54
+ < Title > { nameUF } </ Title >
55
+ < Subtitle > { nameRaster } </ Subtitle >
56
+ </ TopHeader >
57
+ { areas . map ( ( areaInfo : AreaInfo , index ) => (
58
+ < LineInfo key = { index } >
59
+ < TotalArea > { areaInfo . area } </ TotalArea >
60
+ < Color color = { areaInfo . color } $percent = { areaInfo . percent } />
61
+ < PercentArea > { areaInfo . percent } %</ PercentArea >
62
+ </ LineInfo >
63
+ ) ) }
64
+ </ PopupContent >
65
+ ) ;
66
+ } ;
67
+
68
+ export default MapPopup ;
You can’t perform that action at this time.
0 commit comments