Skip to content

Commit 0b048ae

Browse files
committed
chore: map layout to be similar with the list view
LIIKUNTA-422
1 parent af03c1c commit 0b048ae

10 files changed

Lines changed: 181 additions & 125 deletions

File tree

apps/sports-helsinki/env.local

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
NEXT_PUBLIC_FEDERATION_ROUTER_ENDPOINT="https://events-graphql-federation-sports.test.hel.ninja/"
2+
NEXT_PUBLIC_CMS_ORIGIN="https://liikunta.hkih.stage.geniem.io"
3+
NEXT_PUBLIC_LINKEDEVENTS_EVENT_ENDPOINT="https://api.hel.fi/linkedevents/v1/event"
4+
NEXT_PUBLIC_APP_ORIGIN="http://localhost:3000"
5+
NEXT_PUBLIC_IMAGE_PROXY_URL="https://images.weserv.nl/?w=1024&url="
6+
NEXT_PUBLIC_DEBUG="true"
7+
NEXT_PUBLIC_DEFAULT_ISR_REVALIDATE_SECONDS=10
8+
SENTRY_AUTH_TOKEN=
9+
NEXT_PUBLIC_SENTRY_DSN=
10+
NEXT_PUBLIC_SENTRY_ENVIRONMENT="develop"
11+
NEXT_PUBLIC_SENTRY_TRACE_SAMPLE_RATE="1.0"
12+
NEXT_PUBLIC_CMS_HEADER_MENU_NAME_FI="Sports Helsinki Header FI"
13+
NEXT_PUBLIC_CMS_HEADER_MENU_NAME_EN="Sports Helsinki Header EN"
14+
NEXT_PUBLIC_CMS_HEADER_MENU_NAME_SV="Sports Helsinki Header SV"
15+
NEXT_PUBLIC_CMS_FOOTER_MENU_NAME_FI="Sports Helsinki Footer FI"
16+
NEXT_PUBLIC_CMS_FOOTER_MENU_NAME_EN="Sports Helsinki Footer EN"
17+
NEXT_PUBLIC_CMS_FOOTER_MENU_NAME_SV="Sports Helsinki Footer SV"
18+
NEXT_PUBLIC_CMS_ARTICLES_CONTEXT_PATH="/articles"
19+
NEXT_PUBLIC_CMS_PAGES_CONTEXT_PATH="/pages"
20+
NEXT_PUBLIC_MATOMO_URL_BASE="//webanalytics.digiaiiris.com/js/"
21+
NEXT_PUBLIC_MATOMO_SITE_ID=587
22+
NEXT_PUBLIC_MATOMO_SRC_URL="piwik.min.js"
23+
NEXT_PUBLIC_MATOMO_TRACKER_URL="tracker.php"
24+
NEXT_PUBLIC_MATOMO_ENABLED="false"
25+
NEXTJS_DISABLE_SENTRY="true"
26+
NEXTJS_DEBUG_I18N="true"
27+
NEXT_PUBLIC_ALLOW_UNAUTHORIZED_REQUESTS="true"
28+
DOCKER_BUILDKIT="true"
29+
NEXT_PUBLIC_SHOW_SIMILAR_EVENTS="true"
30+
NEXT_PUBLIC_SHOW_SIMILAR_VENUES="true"
31+
NEXT_PUBLIC_SHOW_VENUES_UPCOMING_EVENTS="true"
32+
NEXT_PUBLIC_SHOW_ENROLMENT_STATUS_IN_CARD_DETAILS="false"

apps/sports-helsinki/src/domain/search/searchHeader/SearchHeader.tsx

Lines changed: 86 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { useCommonTranslation, Text } from '@events-helsinki/components';
2-
import { IconCross, Button, IconSearch, IconMenuHamburger } from 'hds-react';
2+
import classNames from 'classnames';
3+
import {
4+
Button,
5+
IconAngleDown,
6+
IconAngleUp,
7+
IconMenuHamburger,
8+
} from 'hds-react';
39
import React, { useRef, useState } from 'react';
10+
import { ContentContainer, PageSection } from 'react-helsinki-headless-cms';
411
import styles from './searchHeader.module.scss';
512

613
/**
@@ -25,77 +32,92 @@ type Props = {
2532

2633
function SearchHeader({ showMode, count, switchShowMode, searchForm }: Props) {
2734
const { t } = useCommonTranslation();
28-
const [collapsed, setCollapsed] = useState<boolean>(true);
35+
const [collapsed, setCollapsed] = useState<boolean>(false);
2936
const formWrapper = useRef<HTMLDivElement>(null);
30-
37+
const collapsedComponent = () => (
38+
<div>
39+
<PageSection
40+
korosBottom={true}
41+
korosBottomClassName={styles.searchContainerKoros}
42+
className={classNames(styles.searchContainer, {})}
43+
>
44+
<ContentContainer className={classNames(styles.contentContainer, {})}>
45+
{searchForm}
46+
</ContentContainer>
47+
</PageSection>
48+
</div>
49+
);
3150
return (
3251
<>
3352
{showMode === ShowMode.MAP && (
3453
<div ref={formWrapper} className={styles.searchHeader}>
35-
{!collapsed && (
36-
<div className={styles.searchMenu}>
37-
{searchForm}
38-
<div className={styles.closeSearchWrapper}>
39-
<Button
40-
className={styles.closeSearch}
41-
variant="secondary"
42-
theme="black"
43-
iconLeft={<IconCross aria-hidden="true" />}
44-
fullWidth
45-
onClick={() => setCollapsed(true)}
54+
<>
55+
{collapsed && collapsedComponent()}
56+
{!collapsed && (
57+
<PageSection>
58+
<div className={styles.horizontalDivider}></div>
59+
</PageSection>
60+
)}
61+
<PageSection>
62+
<ContentContainer>
63+
<div
64+
className={classNames(styles.searchActions, {
65+
[styles.paddingClosed]: !collapsed,
66+
})}
4667
>
47-
{t('common:mapSearch.closeSearchControls')}
48-
</Button>
49-
</div>
50-
</div>
51-
)}
52-
{collapsed && (
53-
<div className={styles.searchActions}>
54-
<Button
55-
variant="secondary"
56-
theme="black"
57-
iconLeft={<IconMenuHamburger aria-hidden="true" />}
58-
onClick={switchShowMode}
59-
>
60-
{t('common:mapSearch.showAsList')}
61-
</Button>
62-
<div className={styles.countAndTags}>
63-
<Text variant="h3">
64-
{count} {t('common:mapSearch.searchResultsCountLabel')}
65-
</Text>
66-
</div>
67-
<Button
68-
variant="secondary"
69-
theme="black"
70-
iconLeft={<IconSearch aria-hidden="true" />}
71-
onClick={() => {
72-
setCollapsed(false);
68+
<div className={styles.countAndTags}>
69+
<Text variant="h3">
70+
{count} {t('common:mapSearch.searchResultsCountLabel')}
71+
</Text>
72+
</div>
73+
<Button
74+
variant="supplementary"
75+
theme="black"
76+
iconLeft={
77+
(collapsed && <IconAngleUp aria-hidden="true" />) ||
78+
(!collapsed && <IconAngleDown aria-hidden="true" />)
79+
}
80+
onClick={() => {
81+
setCollapsed(() => !collapsed);
7382

74-
// This button comes after the actual form in the DOM order.
75-
// It's rendered out of the UI as the state changes to
76-
// !collapsed, but the focus is re-applied to elements that
77-
// come after the form elements.
78-
//
79-
// This makes the UX cumbersome when using a keyboard or a
80-
// screen reader. In order to improve the UX, we are moving
81-
// the focus to the beginning of the form when the user
82-
// opens it.
83-
//
84-
// Wait for form to be rendered into the DOM
85-
setTimeout(() => {
86-
const firstFormInput = formWrapper.current?.querySelector(
87-
'form input'
88-
) as HTMLInputElement | null | undefined;
83+
// This button comes after the actual form in the DOM order.
84+
// It's rendered out of the UI as the state changes to
85+
// !collapsed, but the focus is re-applied to elements that
86+
// come after the form elements.
87+
//
88+
// This makes the UX cumbersome when using a keyboard or a
89+
// screen reader. In order to improve the UX, we are moving
90+
// the focus to the beginning of the form when the user
91+
// opens it.
92+
//
93+
// Wait for form to be rendered into the DOM
94+
setTimeout(() => {
95+
const firstFormInput =
96+
formWrapper.current?.querySelector('form input') as
97+
| HTMLInputElement
98+
| null
99+
| undefined;
89100

90-
// And focus the first input on it
91-
firstFormInput?.focus();
92-
}, 0);
93-
}}
94-
>
95-
{t('common:mapSearch.showSearchParameters')}
96-
</Button>
97-
</div>
98-
)}
101+
// And focus the first input on it
102+
firstFormInput?.focus();
103+
}, 0);
104+
}}
105+
>
106+
{collapsed && t('common:mapSearch.hideSearchParameters')}
107+
{!collapsed && t('common:mapSearch.showSearchParameters')}
108+
</Button>
109+
<Button
110+
variant="secondary"
111+
theme="black"
112+
iconLeft={<IconMenuHamburger aria-hidden="true" />}
113+
onClick={switchShowMode}
114+
>
115+
{t('common:mapSearch.showAsList')}
116+
</Button>
117+
</div>
118+
</ContentContainer>
119+
</PageSection>
120+
</>
99121
</div>
100122
)}
101123
{showMode === ShowMode.LIST && (

apps/sports-helsinki/src/domain/search/searchHeader/searchHeader.module.scss

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
@import 'src/styles/variables';
33

44
.searchHeader {
5-
--background-color: #{$color-engel-medium-light};
65
grid-column: 1 / -1 !important;
76
position: relative;
87
// Give increased z-index to show mobile actions
@@ -50,31 +49,35 @@
5049
background-color: var(--background-color);
5150
display: flex;
5251
flex-direction: row;
53-
align-items: center;
52+
align-items: auto;
5453
position: fixed;
5554
bottom: 0;
5655
left: 0;
5756
right: 0;
5857

5958
@include breakpoints.respond-above(m) {
59+
padding: 0 0 $spacing-layout-xs 0;
6060
position: initial;
61-
padding: $spacing-xs $spacing-s;
6261
}
6362

6463
.countAndTags {
6564
width: 0;
6665
visibility: hidden;
6766

6867
@include breakpoints.respond-above(m) {
68+
display: flex;
6969
visibility: visible;
7070
width: auto;
71-
margin-left: $spacing-layout-l;
71+
align-items: center;
72+
justify-content: center;
7273
}
7374
}
7475

7576
button {
7677
width: 50%;
7778
border: none;
79+
margin-left: auto;
80+
background-color: white;
7881

7982
@include breakpoints.respond-above(m) {
8083
width: unset;
@@ -83,33 +86,30 @@
8386
}
8487
}
8588

86-
button:first-child {
87-
position: relative;
88-
89-
&:after {
90-
content: '';
91-
position: absolute;
92-
border: 2px solid black;
93-
width: 0;
94-
// Add few pixels to make sure border covers the whole height of the container
95-
height: calc(100% + 5px);
96-
border-left: 0;
97-
right: 0;
98-
99-
@include breakpoints.respond-above(m) {
100-
border: none;
101-
}
102-
}
89+
//Select first button element in searchActions div
90+
button:first-of-type {
91+
border: none;
10392
}
10493

10594
@include breakpoints.respond-above(m) {
10695
button:last-child {
107-
margin-left: auto;
96+
margin-left: 0;
10897
}
10998
}
11099
}
111100
}
112101

102+
@include breakpoints.respond-above(m) {
103+
.paddingClosed {
104+
padding: $spacing-layout-xs 0 $spacing-layout-xs 0 !important;
105+
}
106+
}
107+
.horizontalDivider {
108+
//get navigation color...?
109+
border-top: 1px solid #ccc;
110+
width: 100%;
111+
}
112+
113113
.searchArea {
114114
padding-top: $spacing-m;
115115
grid-column: 1 / -1 !important;
@@ -125,3 +125,29 @@
125125

126126
background-color: $color-engel;
127127
}
128+
129+
.searchContainer {
130+
color: var(--color-primary-black);
131+
background-color: var(--color-theme-background);
132+
padding: 2.375rem 0 1.5rem 0;
133+
position: relative;
134+
135+
.noKoros {
136+
margin-bottom: 0 !important;
137+
}
138+
139+
.contentContainer {
140+
margin-bottom: 2.375rem;
141+
142+
h2 {
143+
font-size: var(--fontsize-heading-xl);
144+
font-weight: 500;
145+
margin-top: 2px;
146+
margin-bottom: var(--spacing-xl);
147+
}
148+
}
149+
}
150+
151+
.searchContainerKoros {
152+
fill: var(--color-white);
153+
}

apps/sports-helsinki/src/domain/search/venueSearch/VenueMapSearch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const SimpleVenueMapSearch = () => (
99
searchRoute={SEARCH_ROUTES.MAPSEARCH}
1010
searchUtilities={null}
1111
korosBottom={false}
12-
showTitle={false}
12+
showTitle
1313
className={styles.mapView}
1414
scrollToResultList={() => true}
1515
/>

apps/sports-helsinki/src/domain/search/venueSearch/VenueSearch.tsx

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { useTranslation } from 'next-i18next';
1515
import qs, { parse } from 'query-string';
1616
import type { FormEvent } from 'react';
1717
import React from 'react';
18-
import { ContentContainer, PageSection } from 'react-helsinki-headless-cms';
1918
import IconPersonRunning from '../../../assets/icons/IconPersonRunning';
2019
import SearchAutosuggest from '../../../common-events/components/search/SearchAutosuggest';
2120
import { SEARCH_ROUTES } from '../../../constants';
@@ -238,37 +237,9 @@ export const VenueSearchUtilities: React.FC<SearchUtilitiesProps> = ({
238237

239238
const SimpleVenueSearch: React.FC<SearchComponentProps> = ({
240239
'data-testid': dataTestId,
241-
korosBottom = false,
242-
searchUtilities = null,
243240
className,
244241
...delegatedSimpleVenueSearchFormProps
245242
}) => {
246-
return (
247-
<>
248-
<PageSection
249-
korosBottom={korosBottom}
250-
korosBottomClassName={styles.searchContainerKoros}
251-
className={classNames(styles.searchContainer, className, {
252-
[styles.noKoros]: !korosBottom,
253-
})}
254-
data-testid={dataTestId}
255-
>
256-
<ContentContainer
257-
className={classNames(styles.contentContainer, {
258-
[styles.noKoros]: !korosBottom,
259-
})}
260-
>
261-
<SimpleVenueSearchForm {...delegatedSimpleVenueSearchFormProps} />
262-
</ContentContainer>
263-
</PageSection>
264-
{searchUtilities && (
265-
<PageSection className={styles.searchUtilities}>
266-
<ContentContainer className={styles.contentContainer}>
267-
{searchUtilities}
268-
</ContentContainer>
269-
</PageSection>
270-
)}
271-
</>
272-
);
243+
return <SimpleVenueSearchForm {...delegatedSimpleVenueSearchFormProps} />;
273244
};
274245
export default SimpleVenueSearch;

0 commit comments

Comments
 (0)