mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[PCCompat > Components > Settings] Rewrite to use separate files for each component
This commit is contained in:
parent
0a8d8f09c8
commit
ddddc6015b
5 changed files with 43 additions and 41 deletions
12
moduleWrappers/powercord/components/settings/divider.js
Normal file
12
moduleWrappers/powercord/components/settings/divider.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
const { React } = goosemodScope.webpackModules.common;
|
||||
|
||||
const FormDivider = goosemodScope.webpackModules.findByDisplayName('FormDivider');
|
||||
const SettingsFormClasses = goosemodScope.webpackModules.findByProps('dividerDefault', 'titleDefault');
|
||||
|
||||
export default class Divider extends React.PureComponent {
|
||||
render() {
|
||||
return React.createElement(FormDivider, {
|
||||
className: SettingsFormClasses.dividerDefault
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
const { React } = goosemodScope.webpackModules.common;
|
||||
|
||||
const OriginalTextInput = goosemodScope.webpackModules.findByDisplayName('TextInput');
|
||||
|
||||
const OriginalFormItem = goosemodScope.webpackModules.findByDisplayName('FormItem');
|
||||
const OriginalFormText = goosemodScope.webpackModules.findByDisplayName('FormText');
|
||||
|
||||
|
@ -9,18 +7,7 @@ const Flex = goosemodScope.webpackModules.findByDisplayName('Flex');
|
|||
const Margins = goosemodScope.webpackModules.findByProps('marginTop20', 'marginBottom20');
|
||||
const FormClasses = goosemodScope.webpackModules.findByProps('formText', 'description');
|
||||
|
||||
const FormDivider = goosemodScope.webpackModules.findByDisplayName('FormDivider');
|
||||
const SettingsFormClasses = goosemodScope.webpackModules.findByProps('dividerDefault', 'titleDefault');
|
||||
|
||||
class Divider extends React.PureComponent {
|
||||
render() {
|
||||
return React.createElement(FormDivider, {
|
||||
className: SettingsFormClasses.dividerDefault
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class FormItem extends React.PureComponent {
|
||||
export default class FormItem extends React.PureComponent {
|
||||
render() {
|
||||
return React.createElement(OriginalFormItem, {
|
||||
title: this.props.title,
|
||||
|
@ -38,28 +25,3 @@ class FormItem extends React.PureComponent {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TextInput extends React.PureComponent {
|
||||
render() {
|
||||
const title = this.props.children;
|
||||
delete this.props.children;
|
||||
|
||||
return React.createElement(FormItem, {
|
||||
title,
|
||||
note: this.props.note,
|
||||
required: this.props.required,
|
||||
|
||||
noteHasMargin: true
|
||||
},
|
||||
|
||||
React.createElement(OriginalTextInput, {
|
||||
...this.props
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
FormItem,
|
||||
TextInput
|
||||
};
|
3
moduleWrappers/powercord/components/settings/index.js
Normal file
3
moduleWrappers/powercord/components/settings/index.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
export { default as FormItem } from './formItem';
|
||||
export { default as TextInput } from './textInput';
|
||||
export { default as Divider } from './divider';
|
25
moduleWrappers/powercord/components/settings/textInput.js
Normal file
25
moduleWrappers/powercord/components/settings/textInput.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const { React } = goosemodScope.webpackModules.common;
|
||||
|
||||
import FormItem from './formItem';
|
||||
|
||||
const OriginalTextInput = goosemodScope.webpackModules.findByDisplayName('TextInput');
|
||||
|
||||
export default class TextInput extends React.PureComponent {
|
||||
render() {
|
||||
const title = this.props.children;
|
||||
delete this.props.children;
|
||||
|
||||
return React.createElement(FormItem, {
|
||||
title,
|
||||
note: this.props.note,
|
||||
required: this.props.required,
|
||||
|
||||
noteHasMargin: true
|
||||
},
|
||||
|
||||
React.createElement(OriginalTextInput, {
|
||||
...this.props
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@
|
|||
"powercord/injector": "./moduleWrappers/powercord/injector.js",
|
||||
"powercord/webpack": "./moduleWrappers/powercord/webpack.js",
|
||||
"powercord/util": "./moduleWrappers/powercord/util.js",
|
||||
"powercord/components/settings": "./moduleWrappers/powercord/components/settings.js",
|
||||
"powercord/components/settings": "./moduleWrappers/powercord/components/settings/index.js",
|
||||
|
||||
"_powercord/global": "./moduleWrappers/powercord/global/index.js"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue