Skip to content

Commit c98c3c6

Browse files
committed
Final fixes #2367
1 parent 2472171 commit c98c3c6

File tree

4 files changed

+54
-38
lines changed

4 files changed

+54
-38
lines changed

src/shared/actions/contentful.js

-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ async function getChallengesBlockDone(blockProps) {
267267
filter.technologies = block.fields.technologies.join(',');
268268
}
269269
const challenges = await challengesService.getChallenges(filter);
270-
// console.log('getChallengesBlockDone', block, challenges);
271270

272271
return {
273272
id,

src/shared/components/Contentful/ChallengesBlock/Card/style.scss

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
margin: 10px;
1212
padding: 30px;
1313
text-align: left;
14+
min-height: 350px;
1415
}
1516

1617
.prizes {

src/shared/components/Contentful/ChallengesBlock/index.jsx

+53-36
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,64 @@ export default function ChallengesBlock({
1818
challenges,
1919
fields,
2020
}) {
21+
const challengesToRender = challenges.slice(0, fields.limit || 10);
2122
return (
2223
<div styleName="container">
2324
<h1 styleName="title">{fields.title}</h1>
2425
<div styleName="list">
25-
<Carousel
26-
dragging={false}
27-
slidesToShow={3}
28-
styleName="multiContent"
29-
renderCenterLeftControls={({ previousSlide }) => (
30-
<a
31-
onClick={previousSlide}
32-
onKeyPress={previousSlide}
33-
role="button"
34-
tabIndex={0}
35-
styleName="control"
36-
>
37-
<ArrowPrev />
38-
</a>
39-
)}
40-
renderCenterRightControls={({ nextSlide }) => (
41-
<a
42-
onClick={nextSlide}
43-
onKeyPress={nextSlide}
44-
role="button"
45-
tabIndex={0}
46-
styleName="control"
47-
>
48-
<ArrowNext />
49-
</a>
50-
)}
51-
>
52-
{
53-
challenges.slice(0, fields.limit || 10).map(challenge => (
54-
<Card
55-
baseUrl={baseUrl}
56-
challenge={challenge}
57-
key={challenge.id}
58-
/>
59-
))
26+
{
27+
challengesToRender.length > 2 ? (
28+
<Carousel
29+
dragging={false}
30+
slidesToShow={3}
31+
styleName="multiContent"
32+
framePadding="80px"
33+
heightMode="max"
34+
cellSpacing={30}
35+
autoplay
36+
renderCenterLeftControls={({ previousSlide }) => (
37+
<a
38+
onClick={previousSlide}
39+
onKeyPress={previousSlide}
40+
role="button"
41+
tabIndex={0}
42+
styleName="control"
43+
>
44+
<ArrowPrev />
45+
</a>
46+
)}
47+
renderCenterRightControls={({ nextSlide }) => (
48+
<a
49+
onClick={nextSlide}
50+
onKeyPress={nextSlide}
51+
role="button"
52+
tabIndex={0}
53+
styleName="control"
54+
>
55+
<ArrowNext />
56+
</a>
57+
)}
58+
>
59+
{
60+
challengesToRender.map(challenge => (
61+
<Card
62+
baseUrl={baseUrl}
63+
challenge={challenge}
64+
key={challenge.id}
65+
/>
66+
))
67+
}
68+
</Carousel>
69+
) : (
70+
challengesToRender.map(challenge => (
71+
<Card
72+
baseUrl={baseUrl}
73+
challenge={challenge}
74+
key={challenge.id}
75+
/>
76+
))
77+
)
6078
}
61-
</Carousel>
6279
</div>
6380
{
6481
fields.buttonText && fields.buttonUrl ? (

src/shared/components/Contentful/ChallengesBlock/style.scss

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
display: flex;
1111
flex-wrap: wrap;
1212
justify-content: space-between;
13-
margin-bottom: 40px;
1413

1514
@include xs-to-sm {
1615
flex-direction: column;

0 commit comments

Comments
 (0)