-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Switch components to new standards
- Loading branch information
Showing
4 changed files
with
115 additions
and
183 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,25 @@ | ||
local OnyxUI = script.Parent.Parent | ||
local Fusion = require(OnyxUI.Parent.Fusion) | ||
|
||
local EnsureValue = require(OnyxUI.Utils.EnsureValue) | ||
local Themer = require(OnyxUI.Utils.Themer) | ||
local CombineProps = require(OnyxUI.Utils.CombineProps) | ||
|
||
local Children = Fusion.Children | ||
|
||
local BaseButton = require(OnyxUI.Components.BaseButton) | ||
local BaseButton = require(script.Parent.BaseButton) | ||
local SwitchInput = require(script.Parent.SwitchInput) | ||
|
||
local function SwitchGroup(Props: { [any]: any }) | ||
Props.SwitchedOn = EnsureValue(Props.SwitchedOn, "boolean", false) | ||
Props.Disabled = EnsureValue(Props.Disabled, "boolean", false) | ||
export type Props = SwitchInput.Props & {} | ||
|
||
return BaseButton { | ||
Name = Props.Name, | ||
Parent = Props.Parent, | ||
Position = Props.Position, | ||
Rotation = Props.Rotation, | ||
AnchorPoint = Props.AnchorPoint, | ||
Size = Props.Size, | ||
AutomaticSize = Props.AutomaticSize, | ||
Visible = Props.Visible, | ||
ZIndex = Props.ZIndex, | ||
LayoutOrder = Props.LayoutOrder, | ||
ClipsDescendants = Props.ClipsDescendants, | ||
Active = Props.Active, | ||
Selectable = Props.Selectable, | ||
Interactable = Props.Interactable, | ||
BackgroundColor3 = Props.BackgroundColor3, | ||
BackgroundTransparency = Props.BackgroundTransparency, | ||
local function SwitchGroup(Props: Props) | ||
local Switched = EnsureValue(Props.Switched, "boolean", false) | ||
|
||
return BaseButton(CombineProps(Props, { | ||
Name = "SwitchGroup", | ||
ClickSound = Themer.Theme.Sound.Switch, | ||
|
||
Disabled = Props.Disabled, | ||
|
||
OnActivated = function() | ||
Props.SwitchedOn:set(not Props.SwitchedOn:get()) | ||
Switched:set(not Switched:get()) | ||
end, | ||
|
||
[Children] = Props[Children], | ||
} | ||
})) | ||
end | ||
|
||
return SwitchGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters