-
Notifications
You must be signed in to change notification settings - Fork 960
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
feat(theme): themed-style component #176
Conversation
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.
Need some work, but mostly looks good
@@ -0,0 +1,4 @@ | |||
export { ThemeProvider } from './theme-provider.component'; |
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.
Let's use camelCase
for the whole project.
@@ -0,0 +1,5 @@ | |||
// TODO(@type): declare theme types | |||
|
|||
export type ThemeShape = any; |
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 would rename it to *Type
like ThemeType
not *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.
Let's name the file types.ts
forwardProps, | ||
} from '../service'; | ||
|
||
export interface Props<P> extends React.ClassAttributes<P> { |
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 guess it's better to rename it to ThemedProps
.
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 would also change the name of the parameter to T
as in withTheme
|
||
constructor(props) { | ||
super(props); | ||
this.renderWrappedComponent = this.renderWrappedComponent.bind(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.
Any reason we can't define this methods as lambdas?
); | ||
const themedComponent = component.getByTestId(themeConsumerTestId); | ||
expect(themedComponent.props.themedStyle).not.toBeNull(); | ||
}); |
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.
Make sense to add tests which will check if the component will receive new theme when we change it.
I still sure that we have to rename to |
b151375
to
af4d7c3
Compare
@artyorsh conflicts |
* chore(playground): themed component example * refactor(theme): module structure * feat(theme): themed component props forward * feat(theme): themed-styles component * refactor(theme): themed-styles component to separate file * test(theme): themed-styles component tests * test(theme): describe themed component and styled themed component tests * chore(playground): remove themed component example * chore(lint): update tslint to ignore arrow-functions semicolon * refactor(theme): fix code style issues * test(theme): add theme change test * refactor(theme): fix code style issues * test(theme): add theme provider overrides parent theme test * refactor(theme): remove untracked files
Short description of what this resolves:
theme
module structurewithThemedStyles
HOC which creates themed component and styles for it