Skip to content

Commit

Permalink
climbing: Add to favorites for crags (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvaclavik authored Feb 24, 2024
1 parent e5f2a58 commit 5b3297d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 11 additions & 2 deletions src/components/FeaturePanel/Climbing/ClimbingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useFeatureContext } from '../../utils/FeatureContext';
import { getLabel } from '../../../helpers/featureLabel';
import { getCommonsImageUrl } from '../../../services/images/getWikiImage';
import { getOsmappLink } from '../../../services/helpers';
import { StarButton } from '../ImageSection/StarButton';

const ThumbnailContainer = styled.div<{ height: number }>`
width: 100%;
Expand All @@ -24,6 +25,12 @@ const ThumbnailContainer = styled.div<{ height: number }>`
}
`;

const HeadingContainer = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
`;

const Heading = styled.div`
margin: 12px 8px 4px;
font-size: 36px;
Expand Down Expand Up @@ -102,8 +109,10 @@ export const ClimbingPanel = ({ footer }) => {
<ShowFullscreen onClick={onFullScreenClick} />
</ThumbnailContainer>
)}
<Heading onClick={onFullScreenClick}>{label}</Heading>

<HeadingContainer>
<Heading onClick={onFullScreenClick}>{label}</Heading>
<StarButton />
</HeadingContainer>
<RouteList />

{/* @TODO unite with parent panel */}
Expand Down
15 changes: 7 additions & 8 deletions src/components/FeaturePanel/ImageSection/StarButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Star from '@material-ui/icons/Star';
import StarBorder from '@material-ui/icons/StarBorder';
import React, { useEffect, useState } from 'react';
import { Tooltip } from '@material-ui/core';
import { t } from '../../../services/intl';
import { useStarsContext } from '../../utils/StarsContext';
import { StyledActionButton } from './utils';
Expand All @@ -16,15 +17,13 @@ const useIsClient = () => {
const StarButtonPure = ({ isStarred, toggleStar }) => (
<StyledActionButton onClick={toggleStar}>
{isStarred ? (
<Star
htmlColor="#fff"
titleAccess={t('featurepanel.favorites_save_button')}
/>
<Tooltip arrow title={t('featurepanel.favorites_unsave_button')}>
<Star htmlColor="#fff" />
</Tooltip>
) : (
<StarBorder
htmlColor="#fff"
titleAccess={t('featurepanel.favorites_unsave_button')}
/>
<Tooltip arrow title={t('featurepanel.favorites_save_button')}>
<StarBorder htmlColor="#fff" />
</Tooltip>
)}
</StyledActionButton>
);
Expand Down

0 comments on commit 5b3297d

Please sign in to comment.