diff --git a/package-lock.json b/package-lock.json index 27075c386..fe9612f9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ }, "peerDependencies": { "@edx/frontend-platform": ">1.15.0", - "@edx/paragon": "^20.21.0", + "@edx/paragon": "^20.27.0", "prop-types": "^15.5.10", "react": "^16.14.0", "react-dom": "^16.14.0" diff --git a/package.json b/package.json index fc5f9b095..3568e6685 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ }, "peerDependencies": { "@edx/frontend-platform": ">1.15.0", - "@edx/paragon": "^20.21.0", + "@edx/paragon": "^20.27.0", "prop-types": "^15.5.10", "react": "^16.14.0", "react-dom": "^16.14.0" diff --git a/src/editors/containers/EditorContainer/__snapshots__/index.test.jsx.snap b/src/editors/containers/EditorContainer/__snapshots__/index.test.jsx.snap index 8f1ce57db..acc78abdb 100644 --- a/src/editors/containers/EditorContainer/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/EditorContainer/__snapshots__/index.test.jsx.snap @@ -38,29 +38,22 @@ exports[`EditorContainer component render snapshot: initialized. enable save and - -
+

-

-
- -
-
+ + +
- -
+

-

-
- -
-
+ + + TeST LocALtitLE `; diff --git a/src/editors/containers/EditorContainer/components/TitleHeader/index.jsx b/src/editors/containers/EditorContainer/components/TitleHeader/index.jsx index f0f0f5104..9cc86b198 100644 --- a/src/editors/containers/EditorContainer/components/TitleHeader/index.jsx +++ b/src/editors/containers/EditorContainer/components/TitleHeader/index.jsx @@ -3,7 +3,7 @@ import { useDispatch } from 'react-redux'; import PropTypes from 'prop-types'; import { Icon, IconButton, Truncate } from '@edx/paragon'; -import { Edit } from '@edx/paragon/icons'; +import { EditOutline } from '@edx/paragon/icons'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { localTitleHooks } from './hooks'; @@ -44,17 +44,17 @@ export const TitleHeader = ({ ); } return ( -
+
{localTitle}
); diff --git a/src/editors/containers/EditorContainer/index.jsx b/src/editors/containers/EditorContainer/index.jsx index bd3658801..16fc89d73 100644 --- a/src/editors/containers/EditorContainer/index.jsx +++ b/src/editors/containers/EditorContainer/index.jsx @@ -47,20 +47,19 @@ export const EditorContainer = ({ - -
+

-

-
- -
-
+ + + +
{isInitialized && children} diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/AnswerOption.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/AnswerOption.jsx index 73f07b3ea..02e283ef0 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/AnswerOption.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/AnswerOption.jsx @@ -36,14 +36,14 @@ export const AnswerOption = ({ onToggle={toggleFeedback} className="answer-option d-flex flex-row justify-content-between flex-nowrap pb-2 pt-2" > -
+
-
+
-
+
+
{answers.map((answer) => ( ))} - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
+ + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
`; exports[`SettingsWidget snapshot snapshot: renders Settings widget page advanced settings visible 1`] = ` -
+
-
- - - - + +
+
+ +
+
+ + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
+ + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
`; diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/hooks.js b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/hooks.js index 3fde0c302..a2b6a23db 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/hooks.js +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/hooks.js @@ -172,7 +172,6 @@ export const showAnswerCardHooks = (showAnswer, updateSettings) => { }; export const timerCardHooks = (updateSettings) => ({ - handleChange: (event) => { let time = parseInt(event.target.value); if (_.isNaN(time)) { diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.jsx index b8f0aa374..871fda5e7 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { injectIntl, FormattedMessage } from '@edx/frontend-platform/i18n'; import { connect } from 'react-redux'; import { - Button, Col, Collapsible, Container, Row, + Button, Collapsible, } from '@edx/paragon'; import { selectors, actions } from '../../../../../data/redux'; import ScoringCard from './settingsComponents/ScoringCard'; @@ -32,66 +32,57 @@ export const SettingsWidget = ({ }) => { const { isAdvancedCardsVisible, showAdvancedCards } = showAdvancedSettingsCards(); return ( -
-
- +
+
+ +
+
+ +
+
+
- - - - - - - - - - - - - - - - - - - +
+ + + + + +
- - - - - - - - - - - - - - - - - - - - -
-
+ + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
); }; diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.scss b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.scss index 0a3c728c5..43bc0af73 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.scss +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/index.scss @@ -9,3 +9,19 @@ .spacedMessage { padding-bottom: 1.5rem; } + +.settingsWidget { + margin-top: 40px; +} + +.resetCard { + .resetSettingsButtons { + width: 100%; + } +} + +.hintRow { + .flex-grow-1 { + flex-grow: 1; + } +} diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/HintRow.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/HintRow.jsx index ca3a4a355..283d905dd 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/HintRow.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/HintRow.jsx @@ -1,9 +1,9 @@ import React from 'react'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { - Col, Container, Form, Icon, IconButton, Row, + Form, Icon, IconButton, } from '@edx/paragon'; -import { Delete } from '@edx/paragon/icons'; +import { DeleteOutline } from '@edx/paragon/icons'; import PropTypes from 'prop-types'; import messages from '../messages'; @@ -14,29 +14,26 @@ export const HintRow = ({ // inject intl, }) => ( - - - - - - - - - - +
+ + - - - + +
+
+ +
+
); HintRow.propTypes = { diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/HintsCard.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/HintsCard.jsx index 088fd3eff..acbb0dff0 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/HintsCard.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/HintsCard.jsx @@ -1,12 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, FormattedMessage, intlShape } from '@edx/frontend-platform/i18n'; -import { Button } from '@edx/paragon'; -import { Add } from '@edx/paragon/icons'; import SettingsOption from '../SettingsOption'; import messages from '../messages'; import { hintsCardHooks, hintsRowHooks } from '../hooks'; import HintRow from './HintRow'; +import Button from '../../../../../../sharedComponents/Button'; export const HintsCard = ({ hints, @@ -19,6 +18,7 @@ export const HintsCard = ({ {hints.map((hint) => ( ))} diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/MatlabCard.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/MatlabCard.jsx index d670fcce1..331cab268 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/MatlabCard.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/MatlabCard.jsx @@ -18,6 +18,7 @@ export const MatlabCard = ({
diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ResetCard.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ResetCard.jsx index a52e23043..7c0514fe0 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ResetCard.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ResetCard.jsx @@ -18,6 +18,7 @@ export const ResetCard = ({ title={intl.formatMessage(messages.resetSettingsTitle)} summary={showResetButton ? intl.formatMessage(messages.resetSettingsTrue) : intl.formatMessage(messages.resetSettingsFalse)} + className="resetCard" >
@@ -29,11 +30,11 @@ export const ResetCard = ({
- - - diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/SwitchToAdvancedEditorCard.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/SwitchToAdvancedEditorCard.jsx index b66bc0895..7d058235f 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/SwitchToAdvancedEditorCard.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/SwitchToAdvancedEditorCard.jsx @@ -1,11 +1,12 @@ import React from 'react'; import { connect } from 'react-redux'; import { injectIntl, FormattedMessage } from '@edx/frontend-platform/i18n'; -import { Button, Card } from '@edx/paragon'; +import { Card } from '@edx/paragon'; import PropTypes from 'prop-types'; import messages from '../messages'; import { thunkActions } from '../../../../../../data/redux'; import BaseModal from '../../../../../TextEditor/components/BaseModal'; +import Button from '../../../../../../sharedComponents/Button'; import { confirmSwitchToAdvancedEditor } from '../hooks'; export const SwitchToAdvancedEditorCard = ({ @@ -31,9 +32,9 @@ export const SwitchToAdvancedEditorCard = ({
); diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/HintRow.test.jsx.snap b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/HintRow.test.jsx.snap index a106c71a8..1d44ddf8c 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/HintRow.test.jsx.snap +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/HintRow.test.jsx.snap @@ -1,31 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`HintRow snapshot snapshot: renders hints row 1`] = ` - - - - - - - - - + + - - - + +
+
+ +
+
`; diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/HintsCard.test.jsx.snap b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/HintsCard.test.jsx.snap index 2863895dd..abecf5039 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/HintsCard.test.jsx.snap +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/HintsCard.test.jsx.snap @@ -2,6 +2,8 @@ exports[`HintsCard snapshot snapshot: renders hints setting card multiple hints 1`] = ` @@ -20,9 +22,11 @@ exports[`HintsCard snapshot snapshot: renders hints setting card multiple hints value="" />

@@ -30,15 +29,14 @@ exports[`TypeRow snapshot snapshot: renders type row setting card 1`] = ` exports[`TypeRow snapshot snapshot: renders type row setting card last row 1`] = ` - Text Input Problem @@ -49,7 +47,7 @@ exports[`TypeRow snapshot snapshot: renders type row setting card last row 1`] = className="text-success" /> - +
@@ -58,15 +56,14 @@ exports[`TypeRow snapshot snapshot: renders type row setting card last row 1`] = exports[`TypeRow snapshot snapshot: renders type row setting card not selected 1`] = ` - Text Input Problem @@ -77,7 +74,7 @@ exports[`TypeRow snapshot snapshot: renders type row setting card not selected 1 className="text-success" /> - +
diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/__snapshots__/index.test.jsx.snap b/src/editors/containers/ProblemEditor/components/EditProblemView/__snapshots__/index.test.jsx.snap index f5b33aaa9..1cd7d8a00 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/__snapshots__/index.test.jsx.snap @@ -4,33 +4,30 @@ exports[`EditorProblemView component renders raw editor 1`] = ` - - - - + - - - - - - + } + lang="xml" + /> + + + + +
`; @@ -38,27 +35,24 @@ exports[`EditorProblemView component renders simple view 1`] = ` - - - - - - - - - - - + + + + + + + + `; diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/index.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/index.jsx index f43ddd1d2..03b620a09 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/index.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/index.jsx @@ -2,7 +2,6 @@ import React, { useRef } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; -import { Col, Container, Row } from '@edx/paragon'; import AnswerWidget from './AnswerWidget'; import SettingsWidget from './SettingsWidget'; import QuestionWidget from './QuestionWidget'; @@ -12,6 +11,7 @@ import RawEditor from '../../../../sharedComponents/RawEditor'; import { ProblemTypeKeys } from '../../../../data/constants/problem'; import { parseState } from './hooks'; +import './index.scss'; export const EditProblemView = ({ problemType, @@ -24,23 +24,21 @@ export const EditProblemView = ({ return ( - - - - {isAdvancedProblemType ? ( - - ) : ( - <> - - - - )} - - - - - - +
+ + {isAdvancedProblemType ? ( + + ) : ( + <> + + + + )} + + + + +
); }; diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/index.scss b/src/editors/containers/ProblemEditor/components/EditProblemView/index.scss new file mode 100644 index 000000000..343a67a19 --- /dev/null +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/index.scss @@ -0,0 +1,5 @@ +.editProblemView { + .editProblemView-settingsColumn { + flex-basis: 320px; + } +} \ No newline at end of file diff --git a/src/editors/containers/ProblemEditor/components/SelectTypeModal/content/AdvanceTypeSelect.jsx b/src/editors/containers/ProblemEditor/components/SelectTypeModal/content/AdvanceTypeSelect.jsx index e61eef086..486a3dfbb 100644 --- a/src/editors/containers/ProblemEditor/components/SelectTypeModal/content/AdvanceTypeSelect.jsx +++ b/src/editors/containers/ProblemEditor/components/SelectTypeModal/content/AdvanceTypeSelect.jsx @@ -52,7 +52,7 @@ export const AdvanceTypeSelect = ({ placement="right" overlay={( -
+
{intl.formatMessage(messages.supportStatusTooltipMessage, { supportStatus: data.status.replace(' ', '_') })}
diff --git a/src/editors/containers/ProblemEditor/components/SelectTypeModal/content/__snapshots__/AdvanceTypeSelect.test.jsx.snap b/src/editors/containers/ProblemEditor/components/SelectTypeModal/content/__snapshots__/AdvanceTypeSelect.test.jsx.snap index 971ee0749..0a1b2ad19 100644 --- a/src/editors/containers/ProblemEditor/components/SelectTypeModal/content/__snapshots__/AdvanceTypeSelect.test.jsx.snap +++ b/src/editors/containers/ProblemEditor/components/SelectTypeModal/content/__snapshots__/AdvanceTypeSelect.test.jsx.snap @@ -59,7 +59,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with default overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -114,7 +114,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with default overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -158,7 +158,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with default overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -213,7 +213,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with default overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -317,7 +317,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -372,7 +372,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -416,7 +416,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -471,7 +471,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -575,7 +575,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -630,7 +630,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -674,7 +674,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -729,7 +729,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -833,7 +833,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -888,7 +888,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -932,7 +932,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -987,7 +987,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1091,7 +1091,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1146,7 +1146,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1190,7 +1190,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1245,7 +1245,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1349,7 +1349,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1404,7 +1404,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1448,7 +1448,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1503,7 +1503,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1607,7 +1607,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1662,7 +1662,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1706,7 +1706,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1761,7 +1761,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1865,7 +1865,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1920,7 +1920,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -1964,7 +1964,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality @@ -2019,7 +2019,7 @@ exports[`AdvanceTypeSelect snapshots snapshots: renders as expected with problem overlay={
{supportStatus, select, Provisional {Provisionally supported tools might lack the robustness of functionality diff --git a/src/editors/sharedComponents/Button/hooks.js b/src/editors/sharedComponents/Button/hooks.js new file mode 100644 index 000000000..f12b865fb --- /dev/null +++ b/src/editors/sharedComponents/Button/hooks.js @@ -0,0 +1,23 @@ +/* eslint-disable import/prefer-default-export */ +export const isVariantAdd = (variant) => variant === 'add'; + +export const getButtonProps = ({ variant, className, Add }) => { + const variantClasses = { + default: 'shared-button', + add: 'shared-button pl-0 text-primary-500 button-variant-add', + }; + const variantMap = { + add: 'tertiary', + }; + const classes = [variantClasses[variant]]; + if (className) { classes.push(className); } + + const iconProps = {}; + if (isVariantAdd(variant)) { iconProps.iconBefore = Add; } + + return { + className: classes.join(' '), + variant: variantMap[variant] || variant, + ...iconProps, + }; +}; diff --git a/src/editors/sharedComponents/Button/index.jsx b/src/editors/sharedComponents/Button/index.jsx new file mode 100644 index 000000000..16f05d31f --- /dev/null +++ b/src/editors/sharedComponents/Button/index.jsx @@ -0,0 +1,32 @@ +import React from 'react'; +import { string, node, arrayOf } from 'prop-types'; +import { Button as ParagonButton } from '@edx/paragon'; +import { Add } from '@edx/paragon/icons'; + +import { getButtonProps } from './hooks'; +import './index.scss'; + +const Button = ({ + variant, className, text, children, ...props +}) => ( + + {children || text} + +); +Button.propTypes = { + variant: string, + className: string, + text: string, + children: node || arrayOf(node), +}; +Button.defaultProps = { + variant: 'default', + className: null, + text: null, + children: null, +}; + +export default Button; diff --git a/src/editors/sharedComponents/Button/index.scss b/src/editors/sharedComponents/Button/index.scss new file mode 100644 index 000000000..102cd1456 --- /dev/null +++ b/src/editors/sharedComponents/Button/index.scss @@ -0,0 +1,13 @@ +.button-variant-add { + &:not(:disabled) { + &:not(.disabled) { + &:hover, &:active, &:focus { + background-color: transparent; + + &:before { + display: none; + } + } + } + } +}