-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handling new archiving feature of exercise (setting, adjusting list f…
…ilters, and visualization).
- Loading branch information
1 parent
0d8d920
commit 86083e8
Showing
23 changed files
with
310 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/components/buttons/ArchiveExerciseButton/ArchiveExerciseButton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { ArchiveIcon, LoadingIcon } from '../../icons'; | ||
import Button from '../../widgets/TheButton'; | ||
|
||
const ArchiveExerciseButton = ({ archived, pending, disabled = false, setArchived, ...props }) => ( | ||
<Button | ||
{...props} | ||
variant={disabled ? 'secondary' : pending === false ? 'danger' : 'warning'} | ||
onClick={() => setArchived(!archived)} | ||
disabled={pending || disabled}> | ||
{pending ? <LoadingIcon gapRight /> : <ArchiveIcon archived={archived} gapRight />} | ||
{archived ? ( | ||
<FormattedMessage id="app.archiveExerciseButton.unset" defaultMessage="Excavate from Archive" /> | ||
) : ( | ||
<FormattedMessage id="app.archiveExerciseButton.set" defaultMessage="Archive the Exercise" /> | ||
)} | ||
</Button> | ||
); | ||
|
||
ArchiveExerciseButton.propTypes = { | ||
archived: PropTypes.bool.isRequired, | ||
pending: PropTypes.bool, | ||
disabled: PropTypes.bool, | ||
setArchived: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default ArchiveExerciseButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import ArchiveExerciseButton from './ArchiveExerciseButton'; | ||
export default ArchiveExerciseButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.