From 6513133e9269218f6b3ecf2cc5d5b9f0876bba63 Mon Sep 17 00:00:00 2001 From: mehaknasir <67791278+mehaknasir@users.noreply.github.com> Date: Fri, 30 Apr 2021 18:29:15 +0500 Subject: [PATCH] TNL-8268: Hide features table on mobile view and update mobile design according to figma (#104) Co-authored-by: MehakNasir --- .../discussions/app-list/AppCard.jsx | 15 ++++-- .../discussions/app-list/AppList.jsx | 26 +++++----- .../discussions/app-list/FeaturesList.jsx | 52 +++++++++++++++++++ .../discussions/app-list/messages.js | 10 ++++ 4 files changed, 87 insertions(+), 16 deletions(-) create mode 100644 src/pages-and-resources/discussions/app-list/FeaturesList.jsx diff --git a/src/pages-and-resources/discussions/app-list/AppCard.jsx b/src/pages-and-resources/discussions/app-list/AppCard.jsx index 42be175fa..1f95ddbd9 100644 --- a/src/pages-and-resources/discussions/app-list/AppCard.jsx +++ b/src/pages-and-resources/discussions/app-list/AppCard.jsx @@ -2,12 +2,14 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; -import { Card, CheckboxControl } from '@edx/paragon'; - +import { + Card, CheckboxControl, ExtraSmall, +} from '@edx/paragon'; import messages from './messages'; +import FeaturesList from './FeaturesList'; function AppCard({ - app, onClick, intl, selected, + app, onClick, intl, selected, features, }) { const supportText = app.hasFullSupport ? intl.formatMessage(messages.appFullSupport) @@ -49,6 +51,12 @@ function AppCard({ {supportText} {intl.formatMessage(messages[`appDescription-${app.id}`])} + + + ); @@ -63,6 +71,7 @@ AppCard.propTypes = { onClick: PropTypes.func.isRequired, selected: PropTypes.bool.isRequired, intl: intlShape.isRequired, + features: PropTypes.arrayOf(PropTypes.object).isRequired, }; export default injectIntl(AppCard); diff --git a/src/pages-and-resources/discussions/app-list/AppList.jsx b/src/pages-and-resources/discussions/app-list/AppList.jsx index c94713994..ddbb4cfb5 100644 --- a/src/pages-and-resources/discussions/app-list/AppList.jsx +++ b/src/pages-and-resources/discussions/app-list/AppList.jsx @@ -1,6 +1,6 @@ import React, { useCallback, useEffect } from 'react'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; -import { CardGrid, Container } from '@edx/paragon'; +import { CardGrid, Container, LargerThanExtraSmall } from '@edx/paragon'; import { useDispatch, useSelector } from 'react-redux'; import { useModels } from '../../../generic/model-store'; @@ -69,21 +69,21 @@ function AppList({ intl }) { app={app} selected={app.id === selectedAppId} onClick={handleSelectApp} + features={features} /> ))} - -

- {intl.formatMessage(messages.supportedFeatures)} -

- -
- -
- + +

+ {intl.formatMessage(messages.supportedFeatures)} +

+
+ +
+
); } diff --git a/src/pages-and-resources/discussions/app-list/FeaturesList.jsx b/src/pages-and-resources/discussions/app-list/FeaturesList.jsx new file mode 100644 index 000000000..5ba1ef9cc --- /dev/null +++ b/src/pages-and-resources/discussions/app-list/FeaturesList.jsx @@ -0,0 +1,52 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faCheck } from '@fortawesome/free-solid-svg-icons'; +import { Remove } from '@edx/paragon/icons'; +import { Collapsible } from '@edx/paragon'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import messages from './messages'; + +const SupportedFeature = ( + + + +); +const NonSupportedFeature = ( + +); + +function FeaturesList({ app, features, intl }) { + return ( + + + {intl.formatMessage(messages['supportedFeatureList-mobile-show'])} + + + {intl.formatMessage(messages['supportedFeatureList-mobile-hide'])} + + + )} + styling="basic" + > + {features && features.map((feature) => ( +
+ {app.featureIds.includes(feature.id) + ? SupportedFeature + : NonSupportedFeature} + {feature.id} +
+ ))} +
+ ); +} + +export default injectIntl(FeaturesList); + +FeaturesList.propTypes = { + app: PropTypes.arrayOf(PropTypes.object).isRequired, + features: PropTypes.arrayOf(PropTypes.object).isRequired, + intl: intlShape.isRequired, +}; diff --git a/src/pages-and-resources/discussions/app-list/messages.js b/src/pages-and-resources/discussions/app-list/messages.js index 4c61af901..ff10cc505 100644 --- a/src/pages-and-resources/discussions/app-list/messages.js +++ b/src/pages-and-resources/discussions/app-list/messages.js @@ -9,6 +9,16 @@ const messages = defineMessages({ id: 'authoring.discussions.supportedFeatures', defaultMessage: 'Supported Features', }, + 'supportedFeatureList-mobile-show': { + id: 'authoring.discussions.supportedFeatureList-mobile-show', + defaultMessage: 'Show supported features', + description: 'This is used in mobile view as supported feature list heading when close', + }, + 'supportedFeatureList-mobile-hide': { + id: 'authoring.discussions.supportedFeatureList-mobile-hide', + defaultMessage: 'Hide supported features', + description: 'This is used in mobile view as supported feature list heading when opened', + }, noApps: { id: 'authoring.discussions.noApps', defaultMessage: 'There are no discussions providers available for your course.',