File tree Expand file tree Collapse file tree 3 files changed +81
-19
lines changed
src/stories/Library/recommender Expand file tree Collapse file tree 3 files changed +81
-19
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,24 @@ export default {
77 argTypes : {
88 title : {
99 control : "text" ,
10- defaultValue :
11- "Kunne du lide “Audrey Hepburn” og mangler du noget at læse?" ,
10+ defaultValue : "Because you have borrowed something you may also like" ,
1211 } ,
1312 bright : {
1413 control : { type : "boolean" } ,
1514 defaultValue : true ,
1615 } ,
16+ padding : {
17+ control : { type : "boolean" } ,
18+ defaultValue : true ,
19+ } ,
20+ titleLeft : {
21+ control : { type : "boolean" } ,
22+ defaultValue : false ,
23+ } ,
24+ triple : {
25+ control : { type : "boolean" } ,
26+ defaultValue : true ,
27+ } ,
1728 recommenderData : {
1829 control : "object" ,
1930 defaultValue : [
@@ -42,9 +53,20 @@ export default {
4253 } ,
4354} as ComponentMeta < typeof Recommender > ;
4455
45- const Template : ComponentStory < typeof Recommender > = ( args ) => (
56+ const RecommenderMC : ComponentStory < typeof Recommender > = ( args ) => (
57+ < Recommender { ...args } />
58+ ) ;
59+
60+ const SomethingSimilarMC : ComponentStory < typeof Recommender > = ( args ) => (
4661 < Recommender { ...args } />
4762) ;
4863
49- export const Recommend = Template . bind ( { } ) ;
64+ export const Recommend = RecommenderMC . bind ( { } ) ;
65+ export const SomethingSimilar = SomethingSimilarMC . bind ( { } ) ;
5066Recommend . args = { } ;
67+ SomethingSimilar . args = {
68+ padding : false ,
69+ titleLeft : true ,
70+ title : "Something similar" ,
71+ triple : false ,
72+ } ;
Original file line number Diff line number Diff line change @@ -10,16 +10,33 @@ export type RecommenderProps = {
1010 recommenderData : RecommenderData [ ] ;
1111 title : string ;
1212 bright : boolean ;
13+ padding : boolean ;
14+ titleLeft : boolean ;
15+ triple : boolean ;
1316} ;
1417
1518const Recommender : React . FC < RecommenderProps > = ( {
1619 recommenderData,
1720 title,
1821 bright,
22+ padding,
23+ titleLeft,
24+ triple,
1925} ) => {
2026 return (
21- < div className = { `recommender ${ bright ? "recommender--bright" : "" } ` } >
22- < h2 className = "recommender__title text-header-h1" > { title } </ h2 >
27+ < div
28+ className = { `recommender ${ padding ? "recommender--padding-desktop" : "" }
29+ ${ triple ? "recommender--triple-desktop " : "" } ${
30+ bright ? "recommender--bright" : ""
31+ } `}
32+ >
33+ < h2
34+ className = { `${
35+ titleLeft ? "recommender__left-title" : "recommender__title"
36+ } text-header-h1`}
37+ >
38+ { title }
39+ </ h2 >
2340 < div className = "recommender__buttons" >
2441 < button
2542 type = "button"
@@ -36,7 +53,11 @@ const Recommender: React.FC<RecommenderProps> = ({
3653 By the same author
3754 </ button >
3855 </ div >
39- < ul className = "recommender__grid" >
56+ < ul
57+ className = { `${
58+ triple ? "recommender__triple-grid" : "recommender__grid"
59+ } `}
60+ >
4061 { recommenderData . map ( ( { title : recTitle , filled, authors } ) => (
4162 < li
4263 className = { `recommender-material ${
Original file line number Diff line number Diff line change 33 color : $c-text-primary-white ;
44 border-color : $c-text-secondary-gray ;
55
6- @include breakpoint-m {
7- padding : $s-6xl ;
8- }
9-
106 & --bright {
117 background-color : $c-global-primary ;
128 color : $c-text-primary-black ;
139 border-color : $c-global-tertiary-1 ;
10+ }
11+
12+ & --triple-desktop {
13+ @include breakpoint-m {
14+ .recommender-material {
15+ & :last-of-type {
16+ display : none ;
17+ }
18+ }
19+ }
20+ }
1421
22+ & --padding-desktop {
1523 @include breakpoint-m {
1624 padding : $s-6xl ;
1725 }
2533 padding-bottom : $s-6xl ;
2634 }
2735 }
28- & __title--left {
36+
37+ & __left-title {
2938 text-align : left ;
39+ padding-left : $s-md ;
40+
41+ @include breakpoint-m {
42+ padding-left : $s-4xl ;
43+ }
3044 }
3145
3246 & __buttons {
3347 display : flex ;
3448 justify-content : end ;
3549 margin-bottom : $s-md ;
50+ margin-right : $s-md ;
3651 gap : $s-md ;
3752 }
3853
39- & __grid {
54+ & __triple-grid {
4055 display : grid ;
4156 grid-template-columns : 50% 50% ;
4257 grid-template-rows : 50% 50% ;
4560 grid-template-columns : 33.33% 33.33% 33.33% ;
4661 }
4762 }
63+
64+ & __grid {
65+ display : grid ;
66+ grid-template-columns : 50% 50% ;
67+ grid-template-rows : 50% 50% ;
68+
69+ @include breakpoint-m {
70+ grid-template-columns : 25% 25% 25% 25% ;
71+ }
72+ }
4873}
4974
5075.recommender-material {
5580 position : relative ;
5681 height : 350px ;
5782
58- @include breakpoint-m {
59- & :last-of-type {
60- display : none ;
61- }
62- }
63-
6483 & --bright {
6584 border : 1px solid $c-global-tertiary-1 ;
6685 }
You can’t perform that action at this time.
0 commit comments