diff options
author | megumin <megumin.bakaretsurie@gmail.com> | 2022-10-19 20:57:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 21:57:27 +0200 |
commit | 1f50f78912caeeff1c65182d61b72e6ec95b9899 (patch) | |
tree | 8b1bc59c606617d7a8c39951950dc3c3e7bfd074 /src/components/PluginSettings/PluginModal.tsx | |
parent | efab399309a44f8ea6a783abd13c49abb8cd6e38 (diff) | |
download | Vencord-1f50f78912caeeff1c65182d61b72e6ec95b9899.tar.gz Vencord-1f50f78912caeeff1c65182d61b72e6ec95b9899.tar.bz2 Vencord-1f50f78912caeeff1c65182d61b72e6ec95b9899.zip |
feat: settings sliders (#120)
Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'src/components/PluginSettings/PluginModal.tsx')
-rw-r--r-- | src/components/PluginSettings/PluginModal.tsx | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/components/PluginSettings/PluginModal.tsx b/src/components/PluginSettings/PluginModal.tsx index a324300..3ef36b4 100644 --- a/src/components/PluginSettings/PluginModal.tsx +++ b/src/components/PluginSettings/PluginModal.tsx @@ -15,10 +15,9 @@ import { SettingInputComponent, SettingNumericComponent, SettingSelectComponent, + SettingSliderComponent, } from "./components"; -const { FormSection, FormText, FormTitle } = Forms; - const UserSummaryItem = lazyWebpack(filters.byCode("defaultRenderUser", "showDefaultAvatarsForNullUsers")); const AvatarStyles = lazyWebpack(filters.byProps(["moreUsers", "emptyUser", "avatarContainer", "clickableAvatar"])); const UserRecord: Constructor<Partial<User>> = proxyLazy(() => UserStore.getCurrentUser().constructor) as any; @@ -80,7 +79,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti function renderSettings() { if (!pluginSettings || !plugin.options) { - return <FormText>There are no settings for this plugin.</FormText>; + return <Forms.FormText>There are no settings for this plugin.</Forms.FormText>; } const options: JSX.Element[] = []; @@ -110,6 +109,11 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti } case OptionType.BOOLEAN: { options.push(<SettingBooleanComponent key={key} option={setting} {...props} />); + break; + } + case OptionType.SLIDER: { + options.push(<SettingSliderComponent key={key} option={setting} {...props} />); + break; } } } @@ -142,9 +146,9 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti <Text variant="heading-md/bold">{plugin.name}</Text> </ModalHeader> <ModalContent style={{ marginBottom: 8, marginTop: 8 }}> - <FormSection> - <FormTitle tag="h3">About {plugin.name}</FormTitle> - <FormText>{plugin.description}</FormText> + <Forms.FormSection> + <Forms.FormTitle tag="h3">About {plugin.name}</Forms.FormTitle> + <Forms.FormText>{plugin.description}</Forms.FormText> <div style={{ marginTop: 8, marginBottom: 8, width: "fit-content" }}> <UserSummaryItem users={authors} @@ -157,20 +161,20 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti renderMoreUsers={renderMoreUsers} /> </div> - </FormSection> + </Forms.FormSection> {!!plugin.settingsAboutComponent && ( <div style={{ marginBottom: 8 }}> - <FormSection> + <Forms.FormSection> <ErrorBoundary message="An error occurred while rendering this plugin's custom InfoComponent"> <plugin.settingsAboutComponent /> </ErrorBoundary> - </FormSection> + </Forms.FormSection> </div> )} - <FormSection> - <FormTitle tag="h3">Settings</FormTitle> + <Forms.FormSection> + <Forms.FormTitle tag="h3">Settings</Forms.FormTitle> {renderSettings()} - </FormSection> + </Forms.FormSection> </ModalContent> <ModalFooter> <Flex> |