generated from openedx/frontend-template-application
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update recommendations page design
VAN-1598
- Loading branch information
1 parent
7ca12b6
commit 75cb299
Showing
11 changed files
with
422 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
src/recommendations/RecommendationsPageLayouts/LargeLayout.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import React from 'react'; | ||
|
||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import { Skeleton } from '@edx/paragon'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import loadingCoursesPlaceholders from '../data/loadingCoursesPlaceholders'; | ||
import messages from '../messages'; | ||
import RecommendationsList from '../RecommendationsList'; | ||
|
||
const RecommendationsLargeLayout = (props) => { | ||
const { | ||
userId, | ||
isLoading, | ||
personalizedRecommendations, | ||
trendingProducts, | ||
popularProducts, | ||
} = props; | ||
const { formatMessage } = useIntl(); | ||
|
||
if (isLoading) { | ||
return ( | ||
<> | ||
<Skeleton className="recommendations-heading__skeleton" /> | ||
<Skeleton className="recommendations-subheading__skeleton" /> | ||
<RecommendationsList | ||
recommendations={loadingCoursesPlaceholders} | ||
userId={userId} | ||
isLoading | ||
/> | ||
<Skeleton className="recommendations-subheading__skeleton" /> | ||
<RecommendationsList | ||
recommendations={loadingCoursesPlaceholders} | ||
userId={userId} | ||
isLoading | ||
/> | ||
<Skeleton className="recommendations-subheading__skeleton" /> | ||
<RecommendationsList | ||
recommendations={loadingCoursesPlaceholders} | ||
userId={userId} | ||
isLoading | ||
/> | ||
</> | ||
); | ||
} | ||
return ( | ||
<> | ||
<h2 className="text-sm-center mb-5 mb-sm-4.5 text-left recommendations-container__heading"> | ||
{formatMessage(messages['recommendation.page.heading'])} | ||
</h2> | ||
{personalizedRecommendations.length > 0 && ( | ||
<> | ||
<h3 className="text-sm-center mb-3 text-left"> | ||
{formatMessage(messages['recommendation.option.recommended.for.you'])} | ||
</h3> | ||
<RecommendationsList | ||
recommendations={personalizedRecommendations} | ||
userId={userId} | ||
/> | ||
</> | ||
)} | ||
<h3 className="text-sm-center mb-3 text-left"> | ||
{formatMessage(messages['recommendation.option.popular'])} | ||
</h3> | ||
<RecommendationsList | ||
recommendations={popularProducts} | ||
userId={userId} | ||
/> | ||
<h3 className="text-sm-center mb-3 text-left"> | ||
{formatMessage(messages['recommendation.option.trending'])} | ||
</h3> | ||
<RecommendationsList | ||
recommendations={trendingProducts} | ||
userId={userId} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
RecommendationsLargeLayout.propTypes = { | ||
userId: PropTypes.number.isRequired, | ||
isLoading: PropTypes.bool, | ||
personalizedRecommendations: PropTypes.arrayOf(PropTypes.shape({})), | ||
trendingProducts: PropTypes.arrayOf(PropTypes.shape({})), | ||
popularProducts: PropTypes.arrayOf(PropTypes.shape({})), | ||
}; | ||
|
||
RecommendationsLargeLayout.defaultProps = { | ||
isLoading: true, | ||
personalizedRecommendations: [], | ||
trendingProducts: [], | ||
popularProducts: [], | ||
}; | ||
|
||
export default RecommendationsLargeLayout; |
Oops, something went wrong.