Skip to content

Commit

Permalink
climbing: Climbing Panel small fixes (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvaclavik authored Mar 25, 2024
1 parent 284001c commit 0fdf50c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
12 changes: 10 additions & 2 deletions src/components/FeaturePanel/Climbing/ClimbingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ const HeadingContainer = styled.div`
align-items: center;
`;

const DetailButtonContainer = styled.div`
margin: 8px;
@supports (-webkit-touch-callout: none) {
/* CSS specific to iOS devices */
margin-bottom: 28px;
}
`;

const ParentItem = styled.div`
margin: 12px 8px -4px 8px;
a {
Expand Down Expand Up @@ -145,7 +153,7 @@ export const ClimbingPanel = ({ footer, showTagsTable }) => {
{/* @TODO unite with parent panel */}
<div style={{ padding: '20px 15px 0 15px' }}>{footer}</div>
</PanelScrollbars>
<div style={{ padding: '8px' }}>
<DetailButtonContainer>
<Button
color="primary"
size="large"
Expand All @@ -156,7 +164,7 @@ export const ClimbingPanel = ({ footer, showTagsTable }) => {
>
Show crag detail
</Button>
</div>
</DetailButtonContainer>
</PanelWrapper>
</>
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/FeaturePanel/Climbing/Editor/RouteNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export const RouteNumber = ({ children: routeNumber, x, y }: Props) => {
setRouteIndexHovered,
} = useClimbingContext();
const digits = String(routeNumber).length;
const RECT_WIDTH = ((digits > 2 ? digits : 0) * 3 + 20) / photoZoom.scale;
const RECT_HEIGHT = 20 / photoZoom.scale;
const RECT_Y_OFFSET = 10 / photoZoom.scale;
const RECT_WIDTH = ((digits > 2 ? digits : 0) * 3 + 18) / photoZoom.scale;
const RECT_HEIGHT = 18 / photoZoom.scale;
const RECT_Y_OFFSET = 8 / photoZoom.scale;
const OUTLINE_WIDTH = 2 / photoZoom.scale;
const HOVER_WIDTH = 10 / photoZoom.scale;
const TEXT_Y_SHIFT = 15 / photoZoom.scale;
const TEXT_Y_SHIFT = 13 / photoZoom.scale;

const getX = () => {
const isFarRight = x + RECT_WIDTH / 2 + OUTLINE_WIDTH > imageSize.width;
Expand Down
4 changes: 2 additions & 2 deletions src/components/FeaturePanel/Climbing/RouteNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useRouteNumberColors } from './utils/useRouteNumberColors';
const Container = styled.div<{
colors: Record<string, string>;
}>`
width: 22px;
height: 22px;
width: 20px;
height: 20px;
line-height: 20px;
border-radius: 50%;
background: ${({ colors }) => colors.background};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const useScrollShadow = (deps = []) => {
const { scrollTop, scrollHeight, clientHeight } =
(scrollElementRef.current as any)?.view ?? scrollElementRef.current; // hack because of react-custom-scroll

setIsScrolledToTop(scrollTop === 0);
setIsScrolledToTop(scrollTop <= 0);
setIsScrolledToBottom(
Math.ceil(scrollTop + clientHeight) >= scrollHeight,
);
Expand Down

0 comments on commit 0fdf50c

Please sign in to comment.