-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FeaturePanel: ClimbingGuideInfo update (#900)
- Loading branch information
Showing
7 changed files
with
83 additions
and
33 deletions.
There are no files selected for viewing
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
78 changes: 56 additions & 22 deletions
78
src/components/FeaturePanel/Climbing/ClimbingGuideInfo.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 |
---|---|---|
@@ -1,32 +1,66 @@ | ||
import React from 'react'; | ||
import { Typography } from '@mui/material'; | ||
import { | ||
Accordion, | ||
AccordionDetails, | ||
AccordionSummary, | ||
Button, | ||
Stack, | ||
Typography, | ||
useTheme, | ||
} from '@mui/material'; | ||
import { useFeatureContext } from '../../utils/FeatureContext'; | ||
import { t } from '../../../services/intl'; | ||
import { TooltipButton } from '../../utils/TooltipButton'; | ||
import styled from '@emotion/styled'; | ||
|
||
const Container = styled.div` | ||
font-size: 14px; | ||
margin-bottom: 12px; | ||
`; | ||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; | ||
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos'; | ||
import { LogoOpenClimbing } from '../../../assets/LogoOpenClimbing'; | ||
|
||
export const ClimbingGuideInfo = () => { | ||
const { feature } = useFeatureContext(); | ||
const { persistShowHomepage } = useFeatureContext(); | ||
const theme = useTheme(); | ||
|
||
if ( | ||
!['crag', 'area', 'route', 'route_bottom', 'route_top'].includes( | ||
feature.tags.climbing, | ||
) | ||
) { | ||
return null; | ||
} | ||
const handleClick = () => { | ||
persistShowHomepage(); | ||
}; | ||
|
||
return ( | ||
<Container> | ||
<Typography variant="body2"> | ||
{t('climbing.guideinfo.title')}{' '} | ||
<TooltipButton tooltip={t('climbing.guideinfo.description')} /> | ||
</Typography> | ||
</Container> | ||
<Accordion | ||
disableGutters | ||
elevation={0} | ||
square | ||
sx={{ | ||
borderBottom: `solid 1px ${theme.palette.divider}`, | ||
marginBottom: 2, | ||
}} | ||
> | ||
<AccordionSummary expandIcon={<ExpandMoreIcon color="secondary" />}> | ||
<Stack direction="row" alignItems="center" gap={1}> | ||
<LogoOpenClimbing width={24} /> | ||
<Typography color="secondary" variant="caption"> | ||
<strong>openclimbing.org:</strong> {t('climbing.guideinfo.title')} | ||
</Typography> | ||
</Stack> | ||
</AccordionSummary> | ||
<AccordionDetails> | ||
<Typography variant="body2"> | ||
{t('climbing.guideinfo.description')} | ||
</Typography> | ||
<Stack | ||
direction="row" | ||
justifyContent="flex-end" | ||
alignItems="center" | ||
mt={1} | ||
> | ||
<Button | ||
variant="text" | ||
color="primary" | ||
endIcon={<ArrowForwardIosIcon />} | ||
sx={{ alignSelf: 'flex-end' }} | ||
onClick={handleClick} | ||
> | ||
{t('climbing.guideinfo.button')} | ||
</Button> | ||
</Stack> | ||
</AccordionDetails> | ||
</Accordion> | ||
); | ||
}; |
16 changes: 16 additions & 0 deletions
16
src/components/FeaturePanel/Climbing/FeaturePanelClimbingGuideInfo.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,16 @@ | ||
import { ClimbingGuideInfo } from './ClimbingGuideInfo'; | ||
import { useFeatureContext } from '../../utils/FeatureContext'; | ||
|
||
export const FeaturePanelClimbingGuideInfo = () => { | ||
const { feature } = useFeatureContext(); | ||
|
||
if ( | ||
!['crag', 'area', 'route', 'route_bottom', 'route_top'].includes( | ||
feature.tags.climbing, | ||
) | ||
) { | ||
return null; | ||
} | ||
|
||
return <ClimbingGuideInfo />; | ||
}; |
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
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