-
Notifications
You must be signed in to change notification settings - Fork 2
Rename CioPlpContext to CioPlp #42
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
Conversation
CSL-2888 [MVP] - PLP Grid Component
Business Outcome:
Definition of done:
Additional Notes:
|
| @@ -0,0 +1,56 @@ | |||
| import React from 'react'; | |||
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 changes here just moved the file into CioPlp
| expect(html).toContain('<div>Test</div>'); | ||
| }); | ||
|
|
||
| it('renders CioPlp provider with render props on the server', () => { |
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.
The only new test case for renderProps pattern
| @@ -0,0 +1,59 @@ | |||
| import React from 'react'; | |||
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.
Add tests for client side
src/components/CioPlp/index.tsx
Outdated
| @@ -1,13 +1,52 @@ | |||
| import React from 'react'; | |||
| import { useCioPlpContext } from '../../PlpContext'; | |||
| import React, { useMemo, useState } from 'react'; | |||
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.
This is previously CioPlpContext
src/components/CioPlp/index.tsx
Outdated
| <div>{JSON.stringify(state?.cioClientOptions)}</div> | ||
| </div> | ||
| <PlpContext.Provider value={contextValue}> | ||
| {typeof children === 'function' ? children(contextValue) : children} |
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.
The provider accepts direct children or children function for renderProps pattern support
| @@ -0,0 +1,13 @@ | |||
| import { createContext, useContext } from 'react'; | |||
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.
Moved useCioPlpContext into a hooks file
No new code here
| */ | ||
| export type IncludeRenderProps<P, RenderProps> = P & { | ||
| children?: (props: RenderProps) => ReactNode; | ||
| export type IncludeRenderProps<ComponentProps, ChildrenFunctionProps> = ComponentProps & { |
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.
IncludeRenderProps should accept both a children function {() => ()} or children components <ChildComponent />
| @@ -1,5 +1,4 @@ | |||
| #storybook-root { | |||
| display: flex; | |||
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.
This was breaking the hooks examples
esezen
left a comment
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.
This is looking good. Tagging @Mudaafi to see if he wants to review this before we 🚢
Most of the changes are just renaming CioPlpContext -> CioPlp. The actual code changes are small