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
Fix the prop types #1059
Fix the prop types #1059
Conversation
- Remove longDesc and caseStudyUrl template entries (until we need them). - Move and rename the screen components into screens/. - Add a prop type for screen-specific props. - Unify the way screen components accept screen-specific props. - Rename PrevNextFooter => Navigation.
Also renamed userGuide to userGuideUrl in the template format.
@sohkai @AquiGorka PR ready! 🚦 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 👌
@@ -167,6 +168,12 @@ function Tokens({ | |||
} | |||
}, []) | |||
|
|||
// Focus the token fields as they are added afterwards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intended to be commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that should be removed!
screenSubtitle = 'Have one last look at your settings below', | ||
screenTitle = 'Review information', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove these defaults, since they're supplied by the default props now
screenTitle = 'Claim a name', | ||
}, | ||
screenProps: { back, data, next, screenIndex, screens }, | ||
screenTitle = 'Claim a name', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as ReviewScreen
, I think we can remove the defaults for dataKey
and screenTitle
:)
screenIndex: PropTypes.number.isRequired, | ||
|
||
/* | ||
* No tuples in prop-types… if it existed, screens would look like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could technically define our own validation for a tuple
@@ -0,0 +1,23 @@ | |||
import PropTypes from 'prop-types' | |||
|
|||
export const ScreenPropsType = PropTypes.shape({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In prop-types
we've used the Type
suffix only, rather than PropsType
. What do you think about changing this to just ScreenType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s the Type
suffix added to screenProps
. I know it’s confusing 😆
@@ -140,4 +140,8 @@ function CreateSubtitle({ error }) { | |||
return 'Start your organization with Aragon' | |||
} | |||
|
|||
CreateSubtitle.propTypes = { | |||
error: PropTypes.array.isRequired, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking back at this, we should probably use an object with named fields 😄
@@ -51,10 +56,10 @@ function Configure({ | |||
overflow: hidden; | |||
`} | |||
> | |||
{mode === 'select' && ( | |||
{mode === CONFIGURE_MODE_SELECT && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to think, maybe we should take the template selection part out of configure?
It'd probably simplify a lot of the props we pass around if we split these two (selecting template vs. configuring selected), and I don't think we have any transitions that depend on these two being together.
Builds on #1058