-
-
Save seejee/4d4a16085bf27654b9a227aff6fa8e5c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const ExpansionPack = { | |
isTurnInButtonVisible: () => true, | |
isSignalCheckEnabled: () => false, | |
isPrewritingEnabled: () => false, | |
saveDraftButtonLabel: () => "Save Draft" | |
} | |
const SignalCheck = { | |
isTurnInButtonVisible: (state) => state.assignment.drafts.length > 0, | |
isSignalCheckEnabled: () => true, | |
isPrewritingEnabled: () => true, | |
saveDraftButtonLabel: () => "Signal Check" | |
} | |
// in a reducer | |
{ | |
assignmentType: type === "BC" ? ExpansionPack : SignalCheck | |
} | |
// in a connected component | |
mapStateToProps = (state) => { | |
isTurnInButtonVisible: state.assignment.assignmentType.isTurnInButtonVisible(state), | |
//etc. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment