Bw/recommendations panel (#63)

Co-authored-by: Shafqat Farhan <shafqat.farhan@arbisoft.com>
This commit is contained in:
Ben Warzeski
2022-11-04 15:01:56 -04:00
committed by GitHub
parent b8245d6631
commit dde8d45df3
62 changed files with 1149 additions and 425 deletions

View File

@@ -0,0 +1,44 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`LookingForChallengeWidget snapshots default 1`] = `
<Card
id="looking-for-challenge-widget"
orientation="horizontal"
>
<Card.ImageCap
src="icon/mock/path"
srcAlt="course side widget"
/>
<Card.Body
className="m-auto pr-2"
>
<h4>
Looking for a new challenge?
</h4>
<h5>
<Hyperlink
className="d-flex align-items-center"
destination="course-search-url"
variant="brand"
>
<format-message-function
message={
Object {
"defaultMessage": "Find a course {arrow}",
"description": "Button to explore more courses",
"id": "WidgetSidebar.findCoursesButton",
}
}
values={
Object {
"arrow": <Icon
className="mx-1"
/>,
}
}
/>
</Hyperlink>
</h5>
</Card.Body>
</Card>
`;

View File

@@ -0,0 +1,37 @@
import React from 'react';
import { useIntl } from '@edx/frontend-platform/i18n';
import { Card, Hyperlink, Icon } from '@edx/paragon';
import { ArrowForward } from '@edx/paragon/icons';
import { hooks } from 'data/redux';
import moreCoursesSVG from 'assets/more-courses-sidewidget.svg';
import messages from './messages';
import './index.scss';
export const arrowIcon = (<Icon className="mx-1" src={ArrowForward} />);
export const LookingForChallengeWidget = () => {
const { formatMessage } = useIntl();
const { courseSearchUrl } = hooks.usePlatformSettingsData();
return (
<Card orientation="horizontal" id="looking-for-challenge-widget">
<Card.ImageCap
src={moreCoursesSVG}
srcAlt="course side widget"
/>
<Card.Body className="m-auto pr-2">
<h4>
{formatMessage(messages.lookingForChallengePrompt)}
</h4>
<h5>
<Hyperlink variant="brand" destination={courseSearchUrl} className="d-flex align-items-center">
{formatMessage(messages.findCoursesButton, { arrow: arrowIcon })}
</Hyperlink>
</h5>
</Card.Body>
</Card>
);
};
export default LookingForChallengeWidget;

View File

@@ -0,0 +1,6 @@
#looking-for-challenge-widget {
.pgn__card-wrapper-image-cap {
overflow: visible;
min-width: auto;
}
}

View File

@@ -0,0 +1,20 @@
import { shallow } from 'enzyme';
import LookingForChallengeWidget from '.';
jest.mock('data/redux', () => ({
hooks: {
usePlatformSettingsData: () => ({
courseSearchUrl: 'course-search-url',
}),
},
}));
describe('LookingForChallengeWidget', () => {
describe('snapshots', () => {
test('default', () => {
const wrapper = shallow(<LookingForChallengeWidget />);
expect(wrapper).toMatchSnapshot();
});
});
});

View File

@@ -0,0 +1,16 @@
import { defineMessages } from '@edx/frontend-platform/i18n';
const messages = defineMessages({
lookingForChallengePrompt: {
id: 'WidgetSidebar.lookingForChallengePrompt',
defaultMessage: 'Looking for a new challenge?',
description: 'Prompt user for new challenge',
},
findCoursesButton: {
id: 'WidgetSidebar.findCoursesButton',
defaultMessage: 'Find a course {arrow}',
description: 'Button to explore more courses',
},
});
export default messages;