-
Notifications
You must be signed in to change notification settings - Fork 92
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
WIP: Pulls/4/react dependency injection #70
Changes from all commits
114240e
eef28ab
dd1e111
60de997
2b5e84a
ba1b034
ebfc99e
38782d1
dc9901b
6d817c2
1b2e3e7
00eaaac
3155e8c
77efc96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import Injector from 'lib/Injector'; | ||
import TextField from 'components/TextField/TextField'; | ||
import HiddenField from 'components/HiddenField/HiddenField'; | ||
import DateField from 'components/DateField/DateField'; | ||
import TimeField from 'components/TimeField/TimeField'; | ||
import DatetimeField from 'components/DatetimeField/DatetimeField'; | ||
import CheckboxField from 'components/CheckboxField/CheckboxField'; | ||
import CheckboxSetField from 'components/CheckboxSetField/CheckboxSetField'; | ||
import OptionsetField from 'components/OptionsetField/OptionsetField'; | ||
import GridField from 'components/GridField/GridField'; | ||
import SingleSelectField from 'components/SingleSelectField/SingleSelectField'; | ||
import PopoverField from 'components/PopoverField/PopoverField'; | ||
import HeaderField from 'components/HeaderField/HeaderField'; | ||
import LiteralField from 'components/LiteralField/LiteralField'; | ||
import HtmlReadonlyField from 'components/HtmlReadonlyField/HtmlReadonlyField'; | ||
import LookupField from 'components/LookupField/LookupField'; | ||
import CompositeField from 'components/CompositeField/CompositeField'; | ||
import LabelField from 'components/LabelField/LabelField'; | ||
import Tabs from 'components/Tabs/Tabs'; | ||
import TabItem from 'components/Tabs/TabItem'; | ||
import FormAction from 'components/FormAction/FormAction'; | ||
import FieldGroup from 'components/FieldGroup/FieldGroup'; | ||
import TreeDropdownField from 'components/TreeDropdownField/TreeDropdownField'; | ||
|
||
export default () => { | ||
Injector.register('TextField', TextField); | ||
Injector.register('HiddenField', HiddenField); | ||
Injector.register('DateField', DateField); | ||
Injector.register('TimeField', TimeField); | ||
Injector.register('DatetimeField', DatetimeField); | ||
Injector.register('CheckboxField', CheckboxField); | ||
Injector.register('CheckboxSetField', CheckboxSetField); | ||
Injector.register('OptionsetField', OptionsetField); | ||
Injector.register('GridField', GridField); | ||
Injector.register('FieldGroup', FieldGroup); | ||
Injector.register('SingleSelectField', SingleSelectField); | ||
Injector.register('PopoverField', PopoverField); | ||
Injector.register('HeaderField', HeaderField); | ||
Injector.register('LiteralField', LiteralField); | ||
Injector.register('HtmlReadonlyField', HtmlReadonlyField); | ||
Injector.register('LookupField', LookupField); | ||
Injector.register('CompositeField', CompositeField); | ||
Injector.register('Tabs', Tabs); | ||
Injector.register('TabItem', TabItem); | ||
Injector.register('FormAction', FormAction); | ||
Injector.register('LabelField', LabelField); | ||
Injector.register('TreeDropdownField', TreeDropdownField); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import React from 'react'; | ||
import SilverStripeComponent from 'lib/SilverStripeComponent'; | ||
import { provideInjector } from 'lib/Injector'; | ||
|
||
/** | ||
* Empty container for the moment, will eventually contain the CMS menu` | ||
|
@@ -8,9 +9,10 @@ import SilverStripeComponent from 'lib/SilverStripeComponent'; | |
class App extends SilverStripeComponent { | ||
render() { | ||
// TODO re-add <div className="app"> wrapper when applying to document.body | ||
const Child = React.Children.only(this.props.children); | ||
return (Child); | ||
return <div>{this.props.children}</div>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little cautious of this due to the use of flexbox currently for the But I know you're aware of it, so I'll leave that to after this pull request is ready :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I haven't seen any issues yet, but I have noted it as a temporary hack that needs to be reviewed before merge. |
||
// const Child = React.Children.only(this.props.children); | ||
// return (Child); | ||
} | ||
} | ||
|
||
export default App; | ||
export default provideInjector(App); |
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.
Yay, great way to solve this (
withInjector
context HoC)