-
Notifications
You must be signed in to change notification settings - Fork 134
fix: fixed responsiveness issues on mobile view #1133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,11 @@ import { FormattedDate, FormattedMessage, useIntl } from '@edx/frontend-platform | |
| import { Hyperlink } from '@openedx/paragon'; | ||
| import get from 'lodash.get'; | ||
|
|
||
| import classNames from 'classnames'; | ||
| import professionalCertificateSVG from './assets/professional-certificate.svg'; | ||
| import verifiedCertificateSVG from './assets/verified-certificate.svg'; | ||
| import messages from './Certificates.messages'; | ||
| import { useIsOnMobileScreen } from './data/hooks'; | ||
|
|
||
| const CertificateCard = ({ | ||
| certificateType, | ||
|
|
@@ -27,6 +29,8 @@ const CertificateCard = ({ | |
| audit: null, | ||
| }[certificateType] || null; | ||
|
|
||
| const isMobileView = useIsOnMobileScreen(); | ||
|
|
||
| return ( | ||
| <div | ||
| key={`${modifiedDate}-${courseId}`} | ||
|
|
@@ -37,24 +41,47 @@ const CertificateCard = ({ | |
| className="certificate-type-illustration" | ||
| style={{ backgroundImage: `url(${certificateIllustration})` }} | ||
| /> | ||
| <div className="d-flex flex-column position-relative p-0 width-19625rem"> | ||
| <div className={classNames( | ||
| 'd-flex flex-column position-relative p-0', | ||
| { 'max-width-19rem': isMobileView }, | ||
| { 'width-19625rem': !isMobileView }, | ||
| )} | ||
| > | ||
| <div className="w-100 color-black"> | ||
| <p className="small mb-0 font-weight-normal"> | ||
| <p className={classNames([ | ||
| 'mb-0 font-weight-normal', | ||
| isMobileView ? 'x-small' : 'small', | ||
| ])} | ||
| > | ||
| {intl.formatMessage(get( | ||
| messages, | ||
| `profile.certificates.types.${certificateType}`, | ||
| messages['profile.certificates.types.unknown'], | ||
| ))} | ||
| </p> | ||
| <h4 className="m-0 color-black">{courseDisplayName}</h4> | ||
| <p className="small mb-0"> | ||
| <p className={classNames([ | ||
| 'm-0 color-black', | ||
| isMobileView ? 'h5' : 'h4', | ||
| ])} | ||
| > | ||
|
Comment on lines
+62
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use this <p className={classNames('m-0 color-black', { |
||
| {courseDisplayName} | ||
| </p> | ||
| <p className={classNames([ | ||
| 'mb-0', | ||
| isMobileView ? 'x-small' : 'small', | ||
| ])} | ||
| > | ||
eemaanamir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <FormattedMessage | ||
| id="profile.certificate.organization.label" | ||
| defaultMessage="From" | ||
| /> | ||
| </p> | ||
| <h5 className="mb-0 color-black">{courseOrganization}</h5> | ||
| <p className="small mb-0"> | ||
| <p className={classNames([ | ||
| 'mb-0', | ||
| isMobileView ? 'x-small' : 'small', | ||
| ])} | ||
| > | ||
|
Comment on lines
+80
to
+84
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
| <FormattedMessage | ||
| id="profile.certificate.completion.date.label" | ||
| defaultMessage="Completed on {date}" | ||
|
|
@@ -69,12 +96,20 @@ const CertificateCard = ({ | |
| destination={downloadUrl} | ||
| target="_blank" | ||
| showLaunchIcon={false} | ||
| className="btn btn-primary btn-rounded font-weight-normal px-4 py-0625rem" | ||
| className={classNames( | ||
| 'btn btn-primary btn-rounded font-weight-normal px-4 py-0625rem', | ||
| { 'btn-sm': isMobileView }, | ||
| )} | ||
| > | ||
| {intl.formatMessage(messages['profile.certificates.view.certificate'])} | ||
| </Hyperlink> | ||
| </div> | ||
| <p className="small mb-0 pt-3"> | ||
| <p | ||
| className={classNames([ | ||
| 'mb-0 pt-3', | ||
| isMobileView ? 'x-small' : 'small', | ||
| ])} | ||
| > | ||
| <FormattedMessage | ||
| id="profile.certificate.uuid" | ||
| defaultMessage="Credential ID {certificate_uuid}" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,53 +4,80 @@ import { FormattedMessage } from '@edx/frontend-platform/i18n'; | |
| import { connect } from 'react-redux'; | ||
| import { getConfig } from '@edx/frontend-platform'; | ||
|
|
||
| import classNames from 'classnames'; | ||
| import CertificateCard from './CertificateCard'; | ||
| import { certificatesSelector } from './data/selectors'; | ||
| import { useIsOnMobileScreen, useIsOnTabletScreen } from './data/hooks'; | ||
|
|
||
| const Certificates = ({ certificates }) => ( | ||
| <div> | ||
| <div className="col justify-content-start align-items-start g-5rem p-0"> | ||
| <div className="col align-self-stretch height-2625rem justify-content-start align-items-start p-0"> | ||
| <h2 className="font-weight-bold text-primary-500 m-0"> | ||
| <FormattedMessage | ||
| id="profile.your.certificates" | ||
| defaultMessage="Your certificates" | ||
| description="heading for the certificates section" | ||
| /> | ||
| </h2> | ||
| const Certificates = ({ certificates }) => { | ||
| const isMobileView = useIsOnMobileScreen(); | ||
| const isTabletView = useIsOnTabletScreen(); | ||
| return ( | ||
| <div> | ||
| <div className="col justify-content-start align-items-start g-5rem p-0"> | ||
| <div className="col align-self-stretch height-2625rem justify-content-start align-items-start p-0"> | ||
| <p className={classNames([ | ||
| 'font-weight-bold text-primary-500 m-0', | ||
| isMobileView ? 'h3' : 'h2', | ||
| ])} | ||
|
Comment on lines
+19
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. follow above pattern for classNames and change wherever used |
||
| > | ||
| <FormattedMessage | ||
| id="profile.your.certificates" | ||
| defaultMessage="Your certificates" | ||
| description="heading for the certificates section" | ||
| /> | ||
| </p> | ||
| </div> | ||
| <div className="col justify-content-start align-items-start pt-2 p-0"> | ||
| <p className={classNames([ | ||
| 'font-weight-normal text-gray-800 m-0 p-0', | ||
| isMobileView ? 'h5' : 'p', | ||
| ])} | ||
| > | ||
| <FormattedMessage | ||
| id="profile.certificates.description" | ||
| defaultMessage="Your learner records information is only visible to you. Only your username is visible to others on {siteName}." | ||
| description="description of the certificates section" | ||
| values={{ | ||
| siteName: getConfig().SITE_NAME, | ||
| }} | ||
| /> | ||
| </p> | ||
| </div> | ||
| </div> | ||
| <div className="col justify-content-start align-items-start pt-2 p-0"> | ||
| <p className="font-weight-normal text-gray-800 m-0 p-0"> | ||
| {certificates?.length > 0 ? ( | ||
| <div className="col"> | ||
| <div className={classNames( | ||
| 'row align-items-center pt-5 g-3rem', | ||
| { 'justify-content-center': isTabletView }, | ||
| )} | ||
| > | ||
| {certificates.map(certificate => ( | ||
| <CertificateCard | ||
| key={certificate.courseId} | ||
| certificateType={certificate.certificateType} | ||
| courseDisplayName={certificate.courseDisplayName} | ||
| courseOrganization={certificate.courseOrganization} | ||
| modifiedDate={certificate.modifiedDate} | ||
| downloadUrl={certificate.downloadUrl} | ||
| courseId={certificate.courseId} | ||
| uuid={certificate.uuid} | ||
| /> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ) : ( | ||
| <div className="pt-5"> | ||
| <FormattedMessage | ||
| id="profile.certificates.description" | ||
| defaultMessage="Your learner records information is only visible to you. Only your username is visible to others on {siteName}." | ||
| description="description of the certificates section" | ||
| values={{ | ||
| siteName: getConfig().SITE_NAME, | ||
| }} | ||
| id="profile.no.certificates" | ||
| defaultMessage="You don't have any certificates yet." | ||
| description="displays when user has no course completion certificates" | ||
| /> | ||
| </p> | ||
| </div> | ||
| </div> | ||
| {certificates?.length > 0 ? ( | ||
| <div className="col"> | ||
| <div className="row align-items-center pt-5 g-3rem"> | ||
| {certificates.map(certificate => ( | ||
| <CertificateCard key={certificate.courseId} {...certificate} /> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ) : ( | ||
| <div className="pt-5"> | ||
| <FormattedMessage | ||
| id="profile.no.certificates" | ||
| defaultMessage="You don't have any certificates yet." | ||
| description="displays when user has no course completion certificates" | ||
| /> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| Certificates.propTypes = { | ||
| certificates: PropTypes.arrayOf(PropTypes.shape({ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,27 @@ | ||
| import React from 'react'; | ||
| import { FormattedMessage } from '@edx/frontend-platform/i18n'; | ||
| import { getConfig } from '@edx/frontend-platform'; | ||
| import classNames from 'classnames'; | ||
| import { useIsOnMobileScreen } from './data/hooks'; | ||
|
|
||
| const UsernameDescription = () => ( | ||
| <p className="text-gray-800 font-weight-normal m-0"> | ||
| <FormattedMessage | ||
| id="profile.username.description" | ||
| defaultMessage="Your learner records information is only visible to you. Only your username is visible to others on {siteName}." | ||
| description="A description of the username field" | ||
| values={{ | ||
| siteName: getConfig().SITE_NAME, | ||
| }} | ||
| /> | ||
| </p> | ||
| ); | ||
| const UsernameDescription = () => { | ||
| const isMobileView = useIsOnMobileScreen(); | ||
| return ( | ||
| <p className={classNames([ | ||
| 'text-gray-800 font-weight-normal m-0', | ||
| isMobileView ? 'h5' : 'p', | ||
| ])} | ||
| > | ||
| <FormattedMessage | ||
| id="profile.username.description" | ||
| defaultMessage="Your learner records information is only visible to you. Only your username is visible to others on {siteName}." | ||
| description="A description of the username field" | ||
| values={{ | ||
| siteName: getConfig().SITE_NAME, | ||
| }} | ||
| /> | ||
| </p> | ||
| ); | ||
| }; | ||
|
|
||
| export default UsernameDescription; |
Uh oh!
There was an error while loading. Please reload this page.