Skip to content

Commit b03ab57

Browse files
author
Sine Jespersen
committed
5396: rename search result item
1 parent 17f35cb commit b03ab57

File tree

9 files changed

+38
-41
lines changed

9 files changed

+38
-41
lines changed

architecture/adr-001-skeleton-screens.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ client side or server side.
4040
Because we want to use existing styling setup in conjunction
4141
with the Skeleton Screen Classes we sometimes need to ignore the existing
4242
BEM rules that we normally comply to.
43-
See eg. the [search result styling](../src/stories/Library/search-result-item/search-result-item-skeleton.scss).
43+
See eg. the [search result styling](../src/stories/Library/card-list-item/card-list-item-skeleton.scss).

base.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
@import "./src/stories/Library/autosuggest-text/autosuggest-text";
3939
@import "./src/stories/Library/autosuggest-material/autosuggest-material";
4040
@import "./src/stories/Library/material-card/material-card";
41-
@import "./src/stories/Library/search-result-item/search-result-item";
42-
@import "./src/stories/Library/search-result-item/search-result-item-skeleton";
41+
@import "./src/stories/Library/card-list-item/card-list-item";
42+
@import "./src/stories/Library/card-list-item/card-list-item-skeleton";
4343
@import "./src/stories/Library/Lists/list-reservation/list-reservation";
4444
@import "./src/stories/Library/Lists/list-dashboard/list-dashboard";
4545
@import "./src/stories/Library/Lists/list-description/list-description";

src/stories/Library/search-result-item/SearchResultItem.stories.tsx renamed to src/stories/Library/card-list-item/CardListItem.stories.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { withDesign } from "storybook-addon-designs";
22
import { ComponentMeta, ComponentStory } from "@storybook/react";
3-
4-
import { SearchResultItem } from "./SearchResultItem";
5-
import { SearchResultItemSkeleton } from "./SearchResultItemSkeleton";
3+
import { CardListItem } from "./CardListItem";
4+
import { CardListItemSkeleton } from "./CardListItemSkeleton";
65

76
export default {
8-
title: "Library / Search Result Item",
9-
component: SearchResultItem,
7+
title: "Library / Card List Item",
8+
component: CardListItem,
109
decorators: [withDesign],
1110
parameters: {
1211
design: {
@@ -50,10 +49,10 @@ export default {
5049
defaultValue: 3,
5150
},
5251
},
53-
} as ComponentMeta<typeof SearchResultItem>;
52+
} as ComponentMeta<typeof CardListItem>;
5453

55-
export const Item: ComponentStory<typeof SearchResultItem> = (args) => {
56-
return <SearchResultItem {...args} />;
54+
export const Item: ComponentStory<typeof CardListItem> = (args) => {
55+
return <CardListItem {...args} />;
5756
};
5857

5958
export const ContentOverload = Item.bind({});
@@ -64,8 +63,6 @@ ContentOverload.args = {
6463
availabilityLabels: 25,
6564
};
6665

67-
export const SkeletonItem: ComponentStory<
68-
typeof SearchResultItemSkeleton
69-
> = () => {
70-
return <SearchResultItemSkeleton />;
66+
export const SkeletonItem: ComponentStory<typeof CardListItemSkeleton> = () => {
67+
return <CardListItemSkeleton />;
7168
};

src/stories/Library/search-result-item/SearchResultItem.tsx renamed to src/stories/Library/card-list-item/CardListItem.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import HorizontalTermLine, {
88
} from "../horizontal-term-line/HorizontalTermLine";
99
import { getCoverTint } from "../cover/helper";
1010

11-
export type SearchResultItemProps = {
11+
export type CardListItemProps = {
1212
heartFill?: boolean;
1313
title: string;
1414
author: string;
@@ -18,15 +18,15 @@ export type SearchResultItemProps = {
1818
tintIndex: number;
1919
};
2020

21-
export const SearchResultItem = ({
21+
export const CardListItem = ({
2222
heartFill,
2323
title,
2424
author,
2525
year,
2626
horizontalTermLineData,
2727
availabilityLabels,
2828
tintIndex,
29-
}: SearchResultItemProps) => {
29+
}: CardListItemProps) => {
3030
const materialTypes: AvailabilityLabelPropsType["manifestationType"][] = [
3131
"Bog",
3232
"Ebog",
@@ -35,29 +35,29 @@ export const SearchResultItem = ({
3535
];
3636

3737
return (
38-
<a href="/" className="search-result-item arrow arrow__hover--right-small">
39-
<div className="search-result-item__cover">
38+
<a href="/" className="card-list-item arrow arrow__hover--right-small">
39+
<div className="card-list-item__cover">
4040
<Cover
4141
src="images/book_cover_3.jpg"
4242
size="small"
4343
animate={false}
4444
tint={getCoverTint(tintIndex)}
4545
/>
4646
</div>
47-
<div className="search-result-item__text">
48-
<div className="search-result-item__meta">
47+
<div className="card-list-item__text">
48+
<div className="card-list-item__meta">
4949
<ButtonFavourite fill={heartFill} />
5050
{horizontalTermLineData && (
5151
<HorizontalTermLine {...horizontalTermLineData} />
5252
)}
5353
</div>
5454

55-
<h2 className="search-result-item__title text-header-h4 mb-4">
55+
<h2 className="card-list-item__title text-header-h4 mb-4">
5656
<a href="">{title}</a>
5757
</h2>
5858
<p className="text-small-caption">{`Af ${author} (${year})`}</p>
5959
</div>
60-
<div className="search-result-item__availability">
60+
<div className="card-list-item__availability">
6161
{/* We render the amount of availability labels defined by the story. */}
6262
{Array(availabilityLabels)
6363
.fill(0)

src/stories/Library/search-result-item/SearchResultItemSkeleton.tsx renamed to src/stories/Library/card-list-item/CardListItemSkeleton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
export const SearchResultItemSkeleton = () => {
1+
export const CardListItemSkeleton = () => {
22
return (
3-
<div className="search-result-item arrow arrow__hover--right-small ssc">
3+
<div className="card-list-item arrow arrow__hover--right-small ssc">
44
<div className="ssc-square cover--size-small">&nbsp;</div>
55
<div className="ssc-wrapper">
66
<div className="ssc-head-line mb" />

src/stories/Library/search-result-item/search-result-item-skeleton.scss renamed to src/stories/Library/card-list-item/card-list-item-skeleton.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// we deliberately not follow the BEM naming convention here.
33
/* stylelint-disable plugin/stylelint-bem-namics */
44

5-
.search-result-item {
5+
.card-list-item {
66
&.ssc {
77
grid-template-columns: min-content 1fr;
88
}

src/stories/Library/search-result-item/search-result-item.scss renamed to src/stories/Library/card-list-item/card-list-item.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.search-result-item {
1+
.card-list-item {
22
background-color: #fff;
33
padding: 16px 24px;
44
display: grid;
@@ -20,17 +20,17 @@
2020
}
2121
}
2222

23-
@include arrow("search-result-item");
23+
@include arrow("card-list-item");
2424

25-
.search-result-item__cover {
25+
.card-list-item__cover {
2626
grid-row: span 2;
2727

2828
@include breakpoint-s {
2929
grid-row: auto;
3030
}
3131
}
3232

33-
.search-result-item__availability {
33+
.card-list-item__availability {
3434
grid-column: 2;
3535
display: flex;
3636
align-content: center;
@@ -42,12 +42,12 @@
4242
}
4343
}
4444

45-
.search-result-item__meta {
45+
.card-list-item__meta {
4646
display: flex;
4747
gap: 10px;
4848
}
4949

50-
.search-result-item__title {
50+
.card-list-item__title {
5151
margin-top: 10px;
5252

5353
& > a {

src/stories/Library/search-result-page/SearchResultPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SearchResultItem } from "../search-result-item/SearchResultItem";
1+
import { CardListItem } from "../card-list-item/CardListItem";
22
import { SearchResultInfo } from "./SearchResultInfo";
33
import ResultPager from "./ResultPager";
44
import { SearchResultTitle } from "./SearchResultTitle";
@@ -17,7 +17,7 @@ export type SearchResultPageProps = {
1717
};
1818

1919
const SearchResultList = data.searchResult.map((item, i) => {
20-
return <SearchResultItem {...item} tintIndex={i} />;
20+
return <CardListItem {...item} tintIndex={i} />;
2121
});
2222

2323
export const SearchResultPage = ({

src/stories/Library/search-result-page/SearchResultPageSkeleton.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SearchResultTitle } from "./SearchResultTitle";
2-
import { SearchResultItemSkeleton } from "../search-result-item/SearchResultItemSkeleton";
2+
import { CardListItemSkeleton } from "../card-list-item/CardListItemSkeleton";
33

44
export type SearchResultPageSkeletonProps = {
55
title: string;
@@ -35,19 +35,19 @@ export const SearchResultPageSkeleton = ({
3535
</div>
3636
<ul className="search-result-page__list my-32">
3737
<li>
38-
<SearchResultItemSkeleton />
38+
<CardListItemSkeleton />
3939
</li>
4040
<li>
41-
<SearchResultItemSkeleton />
41+
<CardListItemSkeleton />
4242
</li>
4343
<li>
44-
<SearchResultItemSkeleton />
44+
<CardListItemSkeleton />
4545
</li>
4646
<li>
47-
<SearchResultItemSkeleton />
47+
<CardListItemSkeleton />
4848
</li>
4949
<li>
50-
<SearchResultItemSkeleton />
50+
<CardListItemSkeleton />
5151
</li>
5252
</ul>
5353
</div>

0 commit comments

Comments
 (0)