Skip to content

Commit

Permalink
Merge pull request #699 from danskernesdigitalebibliotek/editorial_se…
Browse files Browse the repository at this point in the history
…arch_DDFFORM-678

Editorial Search DDFFORM-678 / Refactor `.content-list-page__subheading`
  • Loading branch information
kasperbirch1 authored Aug 27, 2024
2 parents b2cba8d + 206af66 commit 5421754
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 78 deletions.
3 changes: 0 additions & 3 deletions base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,12 @@
@import "./src/stories/Library/material-description/material-description";
@import "./src/stories/Library/disclosure/disclosure";
@import "./src/stories/Library/horizontal-term-line/horizontal-term-line";
@import "./src/stories/Library/card-list-page/search-result-info";
@import "./src/stories/Library/card-list-page/card-list-page";
@import "./src/stories/Library/card-list-page/card-list-page-skeleton";
@import "./src/stories/Library/loan-list-page/loan-list-page";
@import "./src/stories/Library/dashboard-page/dashboard-page";
@import "./src/stories/Library/patron-page/patron-page";
@import "./src/stories/Library/reservation-list-page/reservation-list-page";
@import "./src/stories/Library/card-list-page/result-pager";
@import "./src/stories/Library/card-list-page/search-result-title";
@import "./src/stories/Library/card-list-page/search-result-zero";
@import "./src/stories/Library/card-list-page/facet-line";
@import "./src/stories/Library/review/review";
Expand Down
20 changes: 12 additions & 8 deletions src/stories/Blocks/advanced-search/AdvancedSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,20 @@ export const AdvancedSearch: React.FC<AdvancedSearchProps> = ({
/>
</footer>
<div className="advanced-search__divider" />
<section>
<h2 className="text-header-h2 advanced-search__title capitalize-first">
Viser materialer (20)
</h2>
<button className="link-tag mb-16">Link til søgninget</button>
<div className="card-list-page__list my-32">
<section className="content-list-page">
<h2 className="content-list-page__heading">Viser materialer (20)</h2>
<div className="content-list-page__subheading">
<button className="link-tag">Link til søgninget</button>
</div>
<ul className="content-list">
{data.searchResult.map((item, i) => {
return <CardListItem {...item} tintIndex={i} />;
return (
<li className="content-list__item">
<CardListItem {...item} tintIndex={i} key={i} />
</li>
);
})}
</div>
</ul>
<ResultPager currentResults={10} totalResults={20} />
</section>
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/stories/Blocks/content-list-page/ContentListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,24 @@ const ContentListPage: React.FC = () => {
return (
<div className="content-list-page">
<h1 className="content-list-page__heading">Arrangementer</h1>
<div className="content-list-page__filters">
<h2 className="content-list-page__subheading">
Switch to results for the&nbsp;
<a href="/search?q=dans">library materials.</a>
</h2>
<ul className="content-list-page__filters">
{filters.map((filter) => {
return (
<div className="content-list-page__filter">
<li className="content-list-page__filter">
<InputLabel text={filter.label} />
<Dropdown
list={filter.options}
ariaLabel="Kategorier"
arrowIcon="chevron"
/>
</div>
</li>
);
})}
</div>
</ul>
<ContentList items={contentListData} />
</div>
);
Expand Down
8 changes: 6 additions & 2 deletions src/stories/Blocks/content-list-page/content-list-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@
}

.content-list-page__subheading {
@extend %rich-text;

@include layout-container($block-max-width__large);
@include typography($typo__body-small);
color: $color__global-grey;
margin-top: $s-lg;

a {
@include link-tag;
}
}

// Todo should be merged with .facet-line
.content-list-page__filters {
@include layout-container($block-max-width__large);

Expand Down
22 changes: 10 additions & 12 deletions src/stories/Blocks/favorites-list/FavoritesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,26 @@ const FavouritesList: React.FC<FavouritesListProps> = ({
skeletonVersion = false,
materialsCount,
}) => {
const pageTitle = (
<h1 className="text-header-h2 mb-16 search-result-title">Favourites</h1>
);

const materialsCountLine = materialsCount > 0 && (
<p className="text-small-caption my-32">{materialsCount} materials</p>
<h2 className="content-list-page__subheading">
{materialsCount} materials
</h2>
);

const SkeletonList = () => (
<ul className="card-list-page__list my-32">
{[...Array(5)].slice(0, materialsCount).map(() => (
<li>
<ul className="content-list">
{[...Array(5)].slice(0, materialsCount).map((_, i) => (
<li className="content-list__item" key={i}>
<CardListItemSkeleton />
</li>
))}
</ul>
);

const FavouritesListContent = () => (
<ul className="card-list-page__list my-32">
<ul className="content-list">
{data.searchResult.slice(0, materialsCount).map((item, i) => (
<li>
<li className="content-list__item" key={i}>
<CardListItem {...item} heartFill tintIndex={i} />
</li>
))}
Expand All @@ -55,8 +53,8 @@ const FavouritesList: React.FC<FavouritesListProps> = ({
}

return (
<div className="card-list-page">
{pageTitle}
<div className="content-list-page">
<h1 className="content-list-page__heading">Favourites</h1>
{materialsCountLine}
{content}
{!skeletonVersion && (
Expand Down
1 change: 1 addition & 0 deletions src/stories/Library/card-list-item/card-list-item.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Todo: should be renamed.
.card-list-item {
@include show-svg-on-hover;

Expand Down
2 changes: 1 addition & 1 deletion src/stories/Library/card-list-page/SearchResultInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const SearchResultInfo = ({
linkTotalResults,
}: SearchResultInfoProps) => {
return (
<h2 className="text-body-medium-regular search-result-info">
<h2 className="content-list-page__subheading">
Vis i stedet resultater fra{" "}
<a className="link-tag text-body-medium-medium" href="/">
{linkName}
Expand Down
10 changes: 7 additions & 3 deletions src/stories/Library/card-list-page/SearchResultPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export type SearchResultPageProps = {
};

const SearchResultList = data.searchResult.map((item, i) => {
return <CardListItem {...item} tintIndex={i} />;
return (
<li className="content-list__item" key={i}>
<CardListItem {...item} tintIndex={i} />
</li>
);
});

export const SearchResultPage = ({
Expand All @@ -29,7 +33,7 @@ export const SearchResultPage = ({
zeroResult,
}: SearchResultPageProps) => {
return (
<div className="card-list-page">
<div className="content-list-page">
<SearchResultTitle
title={title}
totalResults={zeroResult ? 0 : totalResults}
Expand All @@ -48,7 +52,7 @@ export const SearchResultPage = ({
/>
<FacetLine items={data.facetLineItems} />
<FacetLineSelected items={data.selectedTerms} />
<div className="card-list-page__list my-32">{SearchResultList}</div>
<ul className="content-list">{SearchResultList}</ul>
<ResultPager
currentResults={currentResults}
totalResults={totalResults}
Expand Down
24 changes: 7 additions & 17 deletions src/stories/Library/card-list-page/SearchResultPageSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const SearchResultPageSkeleton = ({
title,
}: SearchResultPageSkeletonProps) => {
return (
<div className="card-list-page">
<div className="content-list-page">
<SearchResultTitle
title={title}
totalResults={0}
Expand All @@ -33,22 +33,12 @@ export const SearchResultPageSkeleton = ({
<div className="ssc-head-line mb" />
</div>
</div>
<ul className="card-list-page__list my-32">
<li>
<CardListItemSkeleton />
</li>
<li>
<CardListItemSkeleton />
</li>
<li>
<CardListItemSkeleton />
</li>
<li>
<CardListItemSkeleton />
</li>
<li>
<CardListItemSkeleton />
</li>
<ul className="content-list">
{[...Array(5)].map((_, index) => (
<li className="content-list__item" key={index}>
<CardListItemSkeleton />
</li>
))}
</ul>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/stories/Library/card-list-page/SearchResultTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const SearchResultTitle = ({
zeroResult,
isLoading = false,
}: SearchResultTitleProps) => {
const classes = clsx(["text-header-h2", "mb-16", "search-result-title"], {
const classes = clsx("content-list-page__heading", {
"text-loading": isLoading,
});
const total = totalResults.toLocaleString("da-Dk");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
.card-list-page__skeleton-facet-line {
&--mobile {
@include layout-container($block-max-width__large);
display: block;
@include media-query__small {
display: none;
}
}

&--desktop {
@include layout-container($block-max-width__large);
display: none;
@include media-query__small {
display: block;
Expand Down
13 changes: 0 additions & 13 deletions src/stories/Library/card-list-page/card-list-page.scss

This file was deleted.

10 changes: 4 additions & 6 deletions src/stories/Library/card-list-page/facet-line.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Todo should be merged with .content-list-page__filters
.facet-line {
width: 100vw;
@include layout-container($block-max-width__large);
max-height: $s-xl;
overflow-x: scroll;
overflow-y: hidden;
display: flex;
flex-wrap: nowrap;
flex-direction: row;
margin-left: -16px;
padding-left: 16px;
// Hide scrollbar
-ms-overflow-style: none; /* for Internet Explorer, Edge */
scrollbar-width: none; /* for Firefox */
Expand All @@ -17,9 +16,6 @@
}

@include media-query__small() {
width: 100%;
margin-left: 0px;
padding-left: 0px;
overflow-y: visible;
max-height: none;
flex-wrap: wrap;
Expand All @@ -46,6 +42,8 @@
margin-bottom: $s-sm;
}

// Todo should be merged with .content-list-page__filters
.facet-line-selected-terms {
@include layout-container($block-max-width__large);
margin-top: $s-md;
}
4 changes: 0 additions & 4 deletions src/stories/Library/card-list-page/search-result-info.scss

This file was deleted.

4 changes: 0 additions & 4 deletions src/stories/Library/card-list-page/search-result-title.scss

This file was deleted.

2 changes: 2 additions & 0 deletions src/stories/Library/content-list/content-list.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.content-list {
@include layout-container($block-max-width__large);
margin-top: $s-xl;
margin-bottom: $s-xl;
}

.content-list__item {
Expand Down

0 comments on commit 5421754

Please sign in to comment.