plugin: Add PluginSettings context item, render it in settings screen

This commit is contained in:
Lucien Greathouse
2020-03-17 23:03:01 -07:00
parent c5ce15fe34
commit 2cefd1bf2e
4 changed files with 161 additions and 34 deletions

View File

@@ -2,10 +2,11 @@ local Roact = require(script:FindFirstAncestor("Rojo").Roact)
local Plugin = script:FindFirstAncestor("Plugin")
local Theme = require(Plugin.Components.Theme)
local Panel = require(Plugin.Components.Panel)
local FitText = require(Plugin.Components.FitText)
local FormButton = require(Plugin.Components.FormButton)
local Panel = require(Plugin.Components.Panel)
local PluginSettings = require(Plugin.Components.PluginSettings)
local Theme = require(Plugin.Components.Theme)
local e = Roact.createElement
@@ -15,32 +16,34 @@ function SettingsPanel:render()
local back = self.props.back
return Theme.with(function(theme)
return e(Panel, nil, {
Layout = Roact.createElement("UIListLayout", {
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
SortOrder = Enum.SortOrder.LayoutOrder,
Padding = UDim.new(0, 8),
}),
return PluginSettings.with(function(settings)
return e(Panel, nil, {
Layout = Roact.createElement("UIListLayout", {
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
SortOrder = Enum.SortOrder.LayoutOrder,
Padding = UDim.new(0, 8),
}),
Text = e(FitText, {
Padding = Vector2.new(12, 6),
Font = theme.ButtonFont,
TextSize = 18,
Text = "This will be a settings panel.",
TextColor3 = theme.Text1,
BackgroundTransparency = 1,
}),
Text = e(FitText, {
Padding = Vector2.new(12, 6),
Font = theme.ButtonFont,
TextSize = 18,
Text = "openScriptsExternally: " .. tostring(settings:get("openScriptsExternally")),
TextColor3 = theme.Text1,
BackgroundTransparency = 1,
}),
DisconnectButton = e(FormButton, {
layoutOrder = 2,
text = "Okay",
secondary = true,
onClick = function()
back()
end,
}),
})
DisconnectButton = e(FormButton, {
layoutOrder = 2,
text = "Okay",
secondary = true,
onClick = function()
back()
end,
}),
})
end)
end)
end