Skip to content

Commit a32d9ed

Browse files
authored
Merge pull request danskernesdigitalebibliotek#117 from reload/feature/reviews
Merge feature/reviews into release/3
2 parents fb5634c + 4f7c257 commit a32d9ed

File tree

13 files changed

+209
-6
lines changed

13 files changed

+209
-6
lines changed

base.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
@import "./src/stories/Library/search-result-page/search-result-pager";
6969
@import "./src/stories/Library/search-result-page/search-result-title";
7070
@import "./src/stories/Library/search-result-page/search-result-zero";
71+
@import "./src/stories/Library/review/review";
7172
@import "./src/stories/Library/shadows/shadows";
7273

7374
// Blocks
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/stories/Blocks/material-page/MaterialPage.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ListDescription, {
66
import fakeData from "../../Library/Lists/list-description/ListDescriptionFakeData";
77
import MaterialDescription from "../../Library/material-description/MaterialDescription";
88
import MaterialHeader from "../../Library/material-header/MaterialHeader";
9+
import { Review } from "../../Library/review/Review";
910
import { MaterialMainfestationItem } from "../material-manifestation-item/MaterialMainfestationItem";
1011

1112
export interface MaterialPageProps {
@@ -50,7 +51,15 @@ const MaterialPage: React.FC<MaterialPageProps> = ({
5051
<ListDescription data={fakeData as ListData} className="pl-80 pb-48" />
5152
</Disclosure>
5253
<Disclosure headline="Anmeldelser" icon="Create">
53-
Content
54+
<Review
55+
numberOfReviews={1}
56+
meta="Meta headline"
57+
hearts={3}
58+
headline="Headline"
59+
body="Body text of the review..."
60+
linkText="Link to review"
61+
linkLink="/"
62+
/>
5463
</Disclosure>
5564
</div>
5665
);

src/stories/Blocks/status-userprofile/statusUserprofile.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default {
3737
},
3838
title: "Afleveret for sent",
3939
showDot: true,
40+
href: "/",
4041
},
4142
{
4243
label: {
@@ -49,6 +50,7 @@ export default {
4950
},
5051
title: "Afleveres snart",
5152
showDot: true,
53+
href: "/",
5254
},
5355
{
5456
number: {
@@ -57,6 +59,7 @@ export default {
5759
},
5860
title: "Længere afleveringstid",
5961
showDot: false,
62+
href: "/",
6063
},
6164
],
6265
},
@@ -84,6 +87,7 @@ export default {
8487
},
8588
title: "Klar til dig",
8689
showDot: true,
90+
href: "/",
8791
},
8892
{
8993
number: {
@@ -92,6 +96,7 @@ export default {
9296
},
9397
title: "Stadig i kø",
9498
showDot: false,
99+
href: "/",
95100
},
96101
],
97102
},

src/stories/Blocks/status-userprofile/statusUserprofile.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const StatusUserprofile = (props: StatusUserprofileProps) => {
3030
number={item.number}
3131
label={item.label}
3232
showDot={item.showDot}
33+
href={item.href}
3334
/>
3435
</div>
3536
))
@@ -51,6 +52,7 @@ export const StatusUserprofile = (props: StatusUserprofileProps) => {
5152
number={item.number}
5253
label={item.label}
5354
showDot={item.showDot}
55+
href={item.href}
5456
/>
5557
</div>
5658
))

src/stories/Library/Buttons/button/Button.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type ButtonProps = {
88
size: "large" | "medium" | "small" | "xsmall";
99
variant: "outline" | "filled";
1010
onClick?: () => void;
11+
classNames?: string;
1112
};
1213

1314
export const Button: React.FC<ButtonProps> = ({
@@ -18,6 +19,7 @@ export const Button: React.FC<ButtonProps> = ({
1819
size,
1920
variant,
2021
onClick,
22+
classNames,
2123
}) => {
2224
const iconClassName = `btn-icon ${collapsible ? "btn-collapsible" : ""}`;
2325

@@ -62,7 +64,7 @@ export const Button: React.FC<ButtonProps> = ({
6264
return (
6365
<button
6466
type="button"
65-
className={`btn-primary ${getVariant()} ${getSize()} arrow__hover--right-small`}
67+
className={`btn-primary ${getVariant()} ${getSize()} arrow__hover--right-small ${classNames}`}
6668
disabled={disabled}
6769
onClick={onClick}
6870
>

src/stories/Library/Forms/checkbox/checkbox.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
transform: translate3d(0, 0, 0);
2323
}
2424

25-
.checkbox__label .checkbox__icon:first-child {
25+
.checkbox__label .checkbox__icon:first-of-type {
2626
position: relative;
2727
flex: 0 0 18px;
2828
width: 18px;
@@ -33,7 +33,7 @@
3333
transition: all 0.3s ease;
3434
}
3535

36-
.checkbox__label .checkbox__icon:first-child svg {
36+
.checkbox__label .checkbox__icon:first-of-type svg {
3737
position: absolute;
3838
top: 3px;
3939
left: 2px;
@@ -58,12 +58,12 @@
5858
}
5959
}
6060

61-
.checkbox__label:hover .checkbox__icon:first-child {
61+
.checkbox__label:hover .checkbox__icon:first-of-type {
6262
border-color: $c-text-secondary-gray;
6363
}
6464

6565
/* stylelint-disable selector-max-compound-selectors */
66-
.checkbox__input:checked + .checkbox__label .checkbox__icon:first-child {
66+
.checkbox__input:checked + .checkbox__label .checkbox__icon:first-of-type {
6767
background: $c-text-secondary-gray;
6868
border-color: $c-text-secondary-gray;
6969
animation: zoom-in-out 0.3s ease;

src/stories/Library/material-header/MaterialHeader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const MaterialHeader: React.FC<MaterialHeaderProps> = ({
7272
disabled={false}
7373
collapsible={false}
7474
size="large"
75+
classNames="capitalize-all"
7576
/>
7677
<Button
7778
label="FIND PÅ HYLDEN"
@@ -80,6 +81,7 @@ const MaterialHeader: React.FC<MaterialHeaderProps> = ({
8081
disabled={false}
8182
collapsible={false}
8283
size="large"
84+
classNames="capitalize-all"
8385
/>
8486
</div>
8587
{ctaText && <p className="mt-16 text-small-caption">{ctaText}</p>}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { ComponentStory, ComponentMeta } from "@storybook/react";
2+
import { withDesign } from "storybook-addon-designs";
3+
import { Review as ReviewsComp } from "./Review";
4+
5+
export default {
6+
title: "Library / Review",
7+
component: ReviewsComp,
8+
decorators: [withDesign],
9+
argTypes: {
10+
numberOfReviews: {
11+
defaultValue: 1,
12+
control: { type: null },
13+
},
14+
meta: {
15+
defaultValue: "Berlingske tidende, 2021.03.19",
16+
control: "text",
17+
},
18+
hearts: {
19+
defaultValue: 5,
20+
},
21+
headline: {
22+
defaultValue: "Anmeldelse af: Efterskælv",
23+
control: "text",
24+
},
25+
body: {
26+
defaultValue:
27+
"Den anerkendte forfatter tager udgangspunkt i sit ægteskabs nøgne efterskælv. Veloplagt, men rystet, byder hun indenfor - også i de mørkeste kamre. Der har aldrig før været en skilsmisse i denne klan....",
28+
control: "text",
29+
},
30+
linkText: {
31+
defaultValue: "Berlingske tidende, 2021.03.19",
32+
control: "text",
33+
},
34+
linkLink: {
35+
defaultValue: "/",
36+
control: "text",
37+
},
38+
},
39+
parameters: {
40+
design: {
41+
type: "figma",
42+
url: "https://www.figma.com/file/ETOZIfmgGS1HUfio57SOh7/S%C3%B8gning?node-id=1030%3A16233",
43+
},
44+
},
45+
} as ComponentMeta<typeof ReviewsComp>;
46+
47+
const Template: ComponentStory<typeof ReviewsComp> = (args) => {
48+
return <ReviewsComp {...args} />;
49+
};
50+
51+
export const Single = Template.bind({});
52+
Single.args = {};
53+
54+
// Show multiple reviews to showcase different spacing
55+
export const Multiple = Template.bind({});
56+
Multiple.args = {
57+
numberOfReviews: 2,
58+
meta: "Berlingske tidende, 2021.03.19",
59+
hearts: 2,
60+
headline: "Headline",
61+
body: "Body text.",
62+
linkLink: "/",
63+
linkText: "Berlingske tidende, 2021.03.19",
64+
};

0 commit comments

Comments
 (0)