Skip to content

Commit

Permalink
fix: card height and load more button (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
melniiv authored Oct 6, 2024
1 parent a8775f4 commit 8e3d077
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 29 deletions.
2 changes: 1 addition & 1 deletion apps/events-helsinki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"react-datepicker": "^4.14.1",
"react-dom": "18.2.0",
"react-error-boundary": "4.0.10",
"react-helsinki-headless-cms": "1.0.0-alpha298",
"react-helsinki-headless-cms": "1.0.0-alpha302",
"react-i18next": "13.0.1",
"react-scroll": "^1.8.9",
"react-toastify": "^9.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ const SearchPage: React.FC<{
showEnrolmentStatusInCardDetails={
AppConfig.showEnrolmentStatusInCardDetails
}
loadMoreButtonVariant="success"
/>
}
orderBySelectComponent={<EventsOrderBySelect />}
Expand Down
3 changes: 3 additions & 0 deletions apps/events-helsinki/src/hooks/useEventsRHHCConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export default function useEventsRHHCConfig(args: {
<HelsinkiCityOwnedIcon {...props} />
),
},
customCopy: {
loadMoreButtonVariant: 'success',
},
siteName: resilientT('appEvents:appName'),
currentLanguageCode: getLanguageCode(locale),
apolloClient,
Expand Down
2 changes: 1 addition & 1 deletion apps/hobbies-helsinki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"react-datepicker": "^4.14.1",
"react-dom": "18.2.0",
"react-error-boundary": "4.0.10",
"react-helsinki-headless-cms": "1.0.0-alpha298",
"react-helsinki-headless-cms": "1.0.0-alpha302",
"react-i18next": "13.0.1",
"react-scroll": "^1.8.9",
"react-toastify": "^9.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ const SearchPage: React.FC<{
showEnrolmentStatusInCardDetails={
AppConfig.showEnrolmentStatusInCardDetails
}
loadMoreButtonVariant="primary"
loadMoreButtonTheme="coat"
/>
}
/>
Expand Down
3 changes: 3 additions & 0 deletions apps/hobbies-helsinki/src/hooks/useHobbiesRHHCConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default function useHobbiesRHHCConfig(args: {
<HelsinkiCityOwnedIcon {...props} />
),
},
customCopy: {
loadMoreButtonTheme: 'coat',
},
siteName: resilientT('appHobbies:appName'),
currentLanguageCode: getLanguageCode(locale),
apolloClient,
Expand Down
2 changes: 1 addition & 1 deletion apps/sports-helsinki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"react-datepicker": "^4.14.1",
"react-dom": "18.2.0",
"react-error-boundary": "4.0.10",
"react-helsinki-headless-cms": "1.0.0-alpha298",
"react-helsinki-headless-cms": "1.0.0-alpha302",
"react-i18next": "13.0.1",
"react-leaflet": "4.2.1",
"react-scroll": "^1.8.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const EventSearchPage: React.FC<SearchPageProps> = ({
showEnrolmentStatusInCardDetails={
AppConfig.showEnrolmentStatusInCardDetails
}
loadMoreButtonVariant="success"
/>
}
orderBySelectComponent={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const VenueList: React.FC<Props> = ({
>
<LoadingSpinner hasPadding={!venues.length} isLoading={loading}>
{hasNext && (
<Button onClick={onLoadMore} variant="secondary" theme="black">
<Button onClick={onLoadMore} variant="success">
{t('buttonLoadMore', { count: venuesLeft })}
</Button>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@
.loadMoreWrapper {
display: flex;
justify-content: center;
button {
border: 2px solid var(--color-primary-black);
}
button:hover {
background-color: var(--color-black-5);
border: 2px solid var(--color-primary-black);
}

&.buttonCentered {
text-align: center;
}
Expand Down
3 changes: 3 additions & 0 deletions apps/sports-helsinki/src/hooks/useSportsRHHCConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default function useSportsRHHCConfig(args: {
<HelsinkiCityOwnedIcon {...props} />
),
},
customCopy: {
loadMoreButtonVariant: 'success',
},
siteName: resilientT('appSports:appName'),
currentLanguageCode: getLanguageCode(locale),
apolloClient,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"react-datepicker": "^4.14.1",
"react-dom": "18.2.0",
"react-error-boundary": "4.0.10",
"react-helsinki-headless-cms": "1.0.0-alpha298",
"react-helsinki-headless-cms": "1.0.0-alpha302",
"react-i18next": "13.0.1",
"react-leaflet": "4.2.1",
"react-toastify": "^9.1.3",
Expand Down
15 changes: 13 additions & 2 deletions packages/components/src/components/eventList/EventList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import classNames from 'classnames';
import { Button } from 'hds-react';
import type { ButtonTheme, ButtonVariant } from 'hds-react';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
import React from 'react';
Expand Down Expand Up @@ -27,6 +28,8 @@ type EventListProps = {
showEnrolmentStatusInCardDetails: boolean;
onLoadMore: () => void;
getEventUrl: GetEventUrlType;
loadMoreButtonVariant?: Exclude<ButtonVariant, 'supplementary'>;
loadMoreButtonTheme?: ButtonTheme;
};

const EventList: React.FC<EventListProps> = ({
Expand All @@ -39,13 +42,14 @@ const EventList: React.FC<EventListProps> = ({
onLoadMore,
getEventUrl,
showEnrolmentStatusInCardDetails = false,
loadMoreButtonVariant = 'secondary',
loadMoreButtonTheme,
}) => {
const { t } = useTranslation('search');
const router = useRouter();
const locale = useLocale();
const eventsLeft = count - events.length;
const EventCardComponent = eventCardsMap[cardSize];

const eventCards = events.map((event) => {
const eventUrl = getEventUrl(event, router, locale);
return (
Expand All @@ -68,7 +72,14 @@ const EventList: React.FC<EventListProps> = ({
>
<LoadingSpinner hasPadding={!events.length} isLoading={loading}>
{hasNext && (
<Button onClick={onLoadMore} variant="secondary" theme="black">
<Button
onClick={onLoadMore}
variant={loadMoreButtonVariant}
theme={
loadMoreButtonTheme ||
(loadMoreButtonVariant === 'secondary' ? 'black' : undefined)
}
>
{t('buttonLoadMore', { count: eventsLeft })}
</Button>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@
.loadMoreWrapper {
display: flex;
justify-content: center;
button {
border: 2px solid var(--color-primary-black);
}
button:hover {
background-color: var(--color-black-5);
border: 2px solid var(--color-primary-black);
}

&.buttonCentered {
text-align: center;
}
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3526,7 +3526,7 @@ __metadata:
react-datepicker: "npm:^4.14.1"
react-dom: "npm:18.2.0"
react-error-boundary: "npm:4.0.10"
react-helsinki-headless-cms: "npm:1.0.0-alpha298"
react-helsinki-headless-cms: "npm:1.0.0-alpha302"
react-i18next: "npm:13.0.1"
react-leaflet: "npm:4.2.1"
react-toastify: "npm:^9.1.3"
Expand Down Expand Up @@ -14365,7 +14365,7 @@ __metadata:
react-datepicker: "npm:^4.14.1"
react-dom: "npm:18.2.0"
react-error-boundary: "npm:4.0.10"
react-helsinki-headless-cms: "npm:1.0.0-alpha298"
react-helsinki-headless-cms: "npm:1.0.0-alpha302"
react-i18next: "npm:13.0.1"
react-scroll: "npm:^1.8.9"
react-toastify: "npm:^9.1.3"
Expand Down Expand Up @@ -16267,7 +16267,7 @@ __metadata:
react-datepicker: "npm:^4.14.1"
react-dom: "npm:18.2.0"
react-error-boundary: "npm:4.0.10"
react-helsinki-headless-cms: "npm:1.0.0-alpha298"
react-helsinki-headless-cms: "npm:1.0.0-alpha302"
react-i18next: "npm:13.0.1"
react-scroll: "npm:^1.8.9"
react-toastify: "npm:^9.1.3"
Expand Down Expand Up @@ -23355,9 +23355,9 @@ __metadata:
languageName: node
linkType: hard

"react-helsinki-headless-cms@npm:1.0.0-alpha298":
version: 1.0.0-alpha298
resolution: "react-helsinki-headless-cms@npm:1.0.0-alpha298"
"react-helsinki-headless-cms@npm:1.0.0-alpha302":
version: 1.0.0-alpha302
resolution: "react-helsinki-headless-cms@npm:1.0.0-alpha302"
dependencies:
hds-design-tokens: "npm:^3.9.0"
html-entities: "npm:^2.4.0"
Expand All @@ -23374,7 +23374,7 @@ __metadata:
peerDependenciesMeta:
"@apollo/client":
optional: true
checksum: fd0922f32be76f1ecaa771df09dd31acf7068c912f868f72fae125356bbc890eecec97b6b55d7cfd5c2fcb2c172129c63f68c81ce16d298664c719a95e9df387
checksum: 32ed5349c293f0cf56c0f7aea54c8ed58b096ef2ec4d8401f7609658b052d1445285501aa0ee75b921df7408c7f5873f2b48348e55a645d0f594ca09b8c4d941
languageName: node
linkType: hard

Expand Down Expand Up @@ -25449,7 +25449,7 @@ __metadata:
react-datepicker: "npm:^4.14.1"
react-dom: "npm:18.2.0"
react-error-boundary: "npm:4.0.10"
react-helsinki-headless-cms: "npm:1.0.0-alpha298"
react-helsinki-headless-cms: "npm:1.0.0-alpha302"
react-i18next: "npm:13.0.1"
react-leaflet: "npm:4.2.1"
react-scroll: "npm:^1.8.9"
Expand Down

0 comments on commit 8e3d077

Please sign in to comment.