Skip to content

Commit

Permalink
Integrate CombineProps into remaining components
Browse files Browse the repository at this point in the history
  • Loading branch information
ImAvafe committed Jun 14, 2024
1 parent a776df5 commit a0b01ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/Components/AutoScaleFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

local Value = Fusion.Value
local Computed = Fusion.Computed
Expand Down Expand Up @@ -30,7 +31,7 @@ return function(Props: Props)
[Out "ViewportSize"] = ViewportSize,
}

return Frame {
return Frame(CombineProps(Props, {
Name = "AutoScaleFrame",
Scale = Computed(function()
local Ratio = ScaleMultiplier:get()
Expand All @@ -40,5 +41,5 @@ return function(Props: Props)
)
return math.clamp(Ratio, MinScale:get(), MaxScale:get())
end),
}
}))
end
5 changes: 3 additions & 2 deletions src/Components/Checkbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local ColorUtils = require(OnyxUI.Parent.ColorUtils)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand Down Expand Up @@ -44,7 +45,7 @@ return function(Props: Props)
end
end)

return BaseButton {
return BaseButton(CombineProps(Props, {
Name = "Checkbox",
BackgroundColor3 = EffectiveColor,
BackgroundTransparency = Spring(
Expand Down Expand Up @@ -114,5 +115,5 @@ return function(Props: Props)
),
},
},
}
}))
end
5 changes: 3 additions & 2 deletions src/Components/SettingToggle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local Themer = require(script.Parent.Parent.Utils.Themer)
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand All @@ -21,7 +22,7 @@ local function SettingToggle(Props: Props)
local Switched = EnsureValue(Props.Switched, "boolean", false)
local Disabled = EnsureValue(Props.Disabled, "boolean", false)

return SwitchGroup {
return SwitchGroup(CombineProps(Props, {
Size = UDim2.fromScale(1, 0),
AutomaticSize = Enum.AutomaticSize.Y,
SwitchedOn = Switched,
Expand Down Expand Up @@ -50,7 +51,7 @@ local function SettingToggle(Props: Props)
Selectable = false,
},
},
}
}))
end

return SettingToggle
5 changes: 3 additions & 2 deletions src/Examples/SettingsMenu.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local CombineProps = require(OnyxUI.Utils.CombineProps)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand All @@ -13,7 +14,7 @@ local SettingToggle = require(OnyxUI.Components.SettingToggle)
local TextInput = require(OnyxUI.Components.TextInput)

return function(Props)
return MenuFrame {
return MenuFrame(CombineProps(Props, {
Parent = Props.Parent,
Size = UDim2.fromOffset(330, 0),
AutomaticSize = Enum.AutomaticSize.Y,
Expand Down Expand Up @@ -74,5 +75,5 @@ return function(Props)
-- Disabled = true,
},
},
}
}))
end

0 comments on commit a0b01ba

Please sign in to comment.