Skip to content

Commit

Permalink
feat: added course card, job card and alert modal (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
zamanafzal authored Aug 16, 2023
1 parent 6a68926 commit dc44829
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
27 changes: 27 additions & 0 deletions src/components/skills-quiz-v2/ClosingAlert.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { ActionRow, AlertModal, Button } from '@edx/paragon';
import PropTypes from 'prop-types';

const ClosingAlert = ({ navigateToSearchPage, hideCloseAlert, showAlert }) => (
<AlertModal

Check warning on line 5 in src/components/skills-quiz-v2/ClosingAlert.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/ClosingAlert.jsx#L5

Added line #L5 was not covered by tests
title="Exit Skills builder?"
isOpen={showAlert}
onClose={hideCloseAlert}
footerNode={(
<ActionRow className="mb-3.5">
<Button variant="tertiary" onClick={hideCloseAlert}>Back to Skills builder</Button>
<Button variant="primary" onClick={navigateToSearchPage}>Exit</Button>
</ActionRow>
)}
>
<p>
Learners who enroll in courses that align with their career goals are more likely to complete the course.
</p>
</AlertModal>
);
ClosingAlert.propTypes = {
navigateToSearchPage: PropTypes.func.isRequired,
hideCloseAlert: PropTypes.func.isRequired,
showAlert: PropTypes.bool.isRequired,
};

export default ClosingAlert;
33 changes: 24 additions & 9 deletions src/components/skills-quiz-v2/SkillsQuiz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import { AppContext } from '@edx/frontend-platform/react';

import GoalDropdown from '../skills-quiz/GoalDropdown';
import {
industryCards,
InterestedJobs,
SKILLS_QUIZ_SEARCH_PAGE_MESSAGE_V2,
} from './constants';
import SkillsQuizHeader from './SkillsQuizHeader';

import headerImage from '../skills-quiz/images/headerImage.png';
import CourseCard from './CourseCard';
import ClosingAlert from './ClosingAlert';

const SkillsQuizV2 = () => {
const [showAdvancedOptions, setShowAdvancedOptions] = useState(false);

Check warning on line 21 in src/components/skills-quiz-v2/SkillsQuiz.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/SkillsQuiz.jsx#L21

Added line #L21 was not covered by tests
Expand All @@ -23,18 +24,27 @@ const SkillsQuizV2 = () => {
const [value, setValue] = useState('green');
const handleChange = (e) => setValue(e.target.value);
const history = useHistory();
const [showAlert, setShowAlert] = useState(false);

Check warning on line 27 in src/components/skills-quiz-v2/SkillsQuiz.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/SkillsQuiz.jsx#L23-L27

Added lines #L23 - L27 were not covered by tests

const closeSkillsQuiz = () => {
const showCloseAlert = () => {
setShowAlert(true);

Check warning on line 30 in src/components/skills-quiz-v2/SkillsQuiz.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/SkillsQuiz.jsx#L29-L30

Added lines #L29 - L30 were not covered by tests
};

const navigateToSearchPage = () => {
history.push(`/${enterpriseConfig.slug}/search`);

Check warning on line 34 in src/components/skills-quiz-v2/SkillsQuiz.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/SkillsQuiz.jsx#L33-L34

Added lines #L33 - L34 were not covered by tests
};

const hideCloseAlert = () => {
setShowAlert(false);

Check warning on line 38 in src/components/skills-quiz-v2/SkillsQuiz.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/SkillsQuiz.jsx#L37-L38

Added lines #L37 - L38 were not covered by tests
};

return (

Check warning on line 41 in src/components/skills-quiz-v2/SkillsQuiz.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/SkillsQuiz.jsx#L41

Added line #L41 was not covered by tests
<ModalDialog
title="Skills Quiz"
size="fullscreen"
className="bg-light-200 skills-quiz-modal"
isOpen
onClose={closeSkillsQuiz}
onClose={showCloseAlert}
>
<ModalDialog.Hero className="md-img">
<ModalDialog.Hero.Background
Expand Down Expand Up @@ -92,22 +102,22 @@ const SkillsQuizV2 = () => {
type="radio"
value={value}
onChange={handleChange}
name="colors"
name="interested-jobs"
columns="3"
className="selectable-box "
>
{industryCards.map((card) => (
{InterestedJobs.map((job) => (
<SelectableBox

Check warning on line 110 in src/components/skills-quiz-v2/SkillsQuiz.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/SkillsQuiz.jsx#L110

Added line #L110 was not covered by tests
className="box"
value={card.name}
value={job.name}
inputHidden={false}
type="radio"
aria-label={card.name}
aria-label={job.name}
>
<div>
<div className="lead">{card.name}</div>
<div className="lead">{job.name}</div>
<div className="x-small">Related skills</div>
{card.skills.map((skill) => (
{job.skills.slice(0, 5).map((skill) => (
<div>

Check warning on line 121 in src/components/skills-quiz-v2/SkillsQuiz.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/skills-quiz-v2/SkillsQuiz.jsx#L121

Added line #L121 was not covered by tests
<Chip>{skill}</Chip>
</div>
Expand All @@ -130,6 +140,11 @@ const SkillsQuizV2 = () => {
<CourseCard />
</CardGrid>
</div>
<ClosingAlert
navigateToSearchPage={navigateToSearchPage}
hideCloseAlert={hideCloseAlert}
showAlert={showAlert}
/>
</Container>
</ModalDialog.Body>
</ModalDialog>
Expand Down
4 changes: 2 additions & 2 deletions src/components/skills-quiz-v2/constants.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export const SKILLS_QUIZ_SEARCH_PAGE_MESSAGE_V2 = 'We combine the educational expertise with labor market data to help you reach your learning and professional goals. Whether you are looking to grow in your career, change careers, or just learn new skills, this toll can help you find a relevant course. Your role selection and recommendations are private and are not visible to your edX administrator.';
export const industryCards = [
export const InterestedJobs = [
{
name: 'Product Associate',
skills: ['Data Analysis', 'Communication', 'Strategy'],
},
{
name: 'Python Developer',
skills: ['Data Analysis', 'Django', 'Flask'],
skills: ['Data Analysis', 'Django', 'Flask', 'Rest', 'Database'],
},
{
name: 'Django Developer',
Expand Down

0 comments on commit dc44829

Please sign in to comment.