-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/show-wind-points-on-map' into add-lines
- Loading branch information
Showing
5 changed files
with
215 additions
and
85 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
...atoryActionStormLayer/AAStormLandfallPopup/PopupContent/__snapshots__/index.test.tsx.snap
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,85 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AAStormLandfallPopup component renders as expected 1`] = ` | ||
<div> | ||
<div | ||
class="makeStyles-itemsContainer-2" | ||
> | ||
<mock-typography | ||
classname="makeStyles-text-4 makeStyles-title-5" | ||
variant="body1" | ||
> | ||
Report date: | ||
2024-03-01 6p.m. | ||
</mock-typography> | ||
<div | ||
class="makeStyles-itemContainer-3" | ||
> | ||
<mock-typography | ||
classname="makeStyles-text-4" | ||
variant="body1" | ||
> | ||
landfall | ||
<span | ||
class="makeStyles-block-1" | ||
> | ||
estimated time | ||
</span> | ||
</mock-typography> | ||
<mock-typography | ||
classname="makeStyles-text-4 makeStyles-textAlignRight-6" | ||
variant="body1" | ||
> | ||
12-03-2025 | ||
<span | ||
class="makeStyles-block-1" | ||
> | ||
06:00 - 12:00 | ||
</span> | ||
</mock-typography> | ||
</div> | ||
<div | ||
class="makeStyles-itemContainer-3" | ||
> | ||
<mock-typography | ||
classname="makeStyles-text-4" | ||
variant="body1" | ||
> | ||
landfall estimated | ||
<span | ||
class="makeStyles-block-1" | ||
> | ||
leadtime | ||
</span> | ||
</mock-typography> | ||
<mock-typography | ||
classname="makeStyles-text-4 makeStyles-textAlignRight-6" | ||
variant="body1" | ||
> | ||
8 - 12 hrs | ||
</mock-typography> | ||
</div> | ||
<div | ||
class="makeStyles-itemContainer-3" | ||
> | ||
<mock-typography | ||
classname="makeStyles-text-4" | ||
variant="body1" | ||
> | ||
District impacted | ||
<span | ||
class="makeStyles-block-1" | ||
> | ||
by landfall | ||
</span> | ||
</mock-typography> | ||
<mock-typography | ||
classname="makeStyles-text-4 makeStyles-textAlignRight-6" | ||
variant="body1" | ||
> | ||
Inhassoro | ||
</mock-typography> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
20 changes: 20 additions & 0 deletions
20
...View/Layers/AnticipatoryActionStormLayer/AAStormLandfallPopup/PopupContent/index.test.tsx
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,20 @@ | ||
import { render } from '@testing-library/react'; | ||
import PopupContent from '.'; | ||
|
||
describe('AAStormLandfallPopup component', () => { | ||
it('renders as expected', () => { | ||
const reportDate = '2024-03-01 6p.m.'; | ||
const landfallInfo = { | ||
landfall_time: ['2024-03-12 00:00:00', '2024-03-12 06:00:00'], | ||
landfall_impact_district: 'Inhassoro', | ||
landfall_impact_intensity: [ | ||
'severe tropical storm', | ||
'moderate tropical storm', | ||
], | ||
}; | ||
const { container } = render( | ||
<PopupContent reportDate={reportDate} landfallInfo={landfallInfo} />, | ||
); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
96 changes: 96 additions & 0 deletions
96
...s/MapView/Layers/AnticipatoryActionStormLayer/AAStormLandfallPopup/PopupContent/index.tsx
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,96 @@ | ||
import { createStyles, makeStyles, Typography } from '@material-ui/core'; | ||
|
||
function PopupContent({ landfallInfo, reportDate }: PopupContentProps) { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.itemsContainer}> | ||
<Typography | ||
variant="body1" | ||
className={`${classes.text} ${classes.title}`} | ||
> | ||
Report date: {reportDate} | ||
</Typography> | ||
<div className={classes.itemContainer}> | ||
<Typography variant="body1" className={classes.text}> | ||
landfall <span className={classes.block}>estimated time</span> | ||
</Typography> | ||
<Typography | ||
variant="body1" | ||
className={`${classes.text} ${classes.textAlignRight}`} | ||
> | ||
12-03-2025 | ||
<span className={classes.block}>06:00 - 12:00</span> | ||
</Typography> | ||
</div> | ||
<div className={classes.itemContainer}> | ||
<Typography variant="body1" className={classes.text}> | ||
landfall estimated | ||
<span className={classes.block}>leadtime</span> | ||
</Typography> | ||
<Typography | ||
variant="body1" | ||
className={`${classes.text} ${classes.textAlignRight}`} | ||
> | ||
8 - 12 hrs | ||
</Typography> | ||
</div> | ||
<div className={classes.itemContainer}> | ||
<Typography variant="body1" className={classes.text}> | ||
District impacted | ||
<span className={classes.block}>by landfall</span> | ||
</Typography> | ||
<Typography | ||
variant="body1" | ||
className={`${classes.text} ${classes.textAlignRight}`} | ||
> | ||
{landfallInfo.landfall_impact_district} | ||
</Typography> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
const useStyles = makeStyles(() => | ||
createStyles({ | ||
block: { | ||
display: 'block', | ||
}, | ||
itemsContainer: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: '2px', | ||
}, | ||
itemContainer: { | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
padding: '8px', | ||
background: '#FFFFFF', | ||
}, | ||
text: { | ||
fontSize: '14px', | ||
lineHeight: '18px', | ||
fontWeight: 400, | ||
}, | ||
title: { | ||
fontWeight: 700, | ||
padding: '2px 0px 2px 8px', | ||
}, | ||
textAlignRight: { | ||
textAlign: 'right', | ||
}, | ||
}), | ||
); | ||
|
||
export interface LandfallInfo { | ||
landfall_time: string[]; | ||
landfall_impact_district: string; | ||
landfall_impact_intensity: string[]; | ||
} | ||
|
||
interface PopupContentProps { | ||
landfallInfo: LandfallInfo; | ||
reportDate: string; | ||
} | ||
|
||
export default PopupContent; |
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