Skip to content

Commit

Permalink
Improve visual indicators of interactability
Browse files Browse the repository at this point in the history
  • Loading branch information
ImAvafe committed Jun 14, 2024
1 parent 31bb91b commit 98c8d2c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/Components/SwitchInput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ return function(Props: Props)
StrokeTransparency = Spring(
Computed(function()
if Disabled:get() then
return 0.9
return 0.8
end
if Switched:get() then
return 0
else
return 0.5
return 0.6
end
end),
Themer.Theme.SpringSpeed["1"],
Expand Down
38 changes: 21 additions & 17 deletions src/Components/TextInput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type Props = Base.Props & {
PlaceholderColor3: PubTypes.CanBeState<Color3>?,
TextXAlignment: PubTypes.CanBeState<Enum.TextXAlignment>?,
TextYAlignment: PubTypes.CanBeState<Enum.TextYAlignment>?,
TextTransparency: PubTypes.CanBeState<number>?,

IsFocused: PubTypes.CanBeState<boolean>?,
OnFocused: PubTypes.CanBeState<() -> ()>?,
Expand All @@ -41,23 +42,17 @@ export type Props = Base.Props & {

return function(Props: Props)
local Disabled = EnsureValue(Props.Disabled, "boolean", false)
local RemainingCharaters = Value(-1)
local IsFocused = EnsureValue(Props.IsFocused, "boolean", false)
local OnFocused = EnsureValue(Props.OnFocused, "function", function() end)
local OnFocusLost = EnsureValue(Props.OnFocusLost, "function", function() end)
local Text = EnsureValue(Props.Text, "string", "")
local Color = EnsureValue(Props.Color, "Color3", Themer.Theme.Colors.Primary.Main)
local CharacterLimit = EnsureValue(Props.CharacterLimit, "number", -1)
local ClearTextOnFocus = EnsureValue(Props.ClearTextOnFocus, "boolean", false)
local PlaceholderText = EnsureValue(Props.PlaceholderText, "string", "")
local TextSize = EnsureValue(Props.TextSize, "number", Themer.Theme.TextSize["1"])
local PlaceholderColor3 = EnsureValue(
Props.PlaceholderColor3,
"Color3",
Computed(function()
if Disabled:get() then
return Themer.Theme.Colors.NeutralContent.Dark:get()
else
return Themer.Theme.Colors.NeutralContent.Light:get()
end
end)
)
local PlaceholderColor3 = EnsureValue(Props.PlaceholderColor3, "Color3", Themer.Theme.Colors.NeutralContent.Dark)
local TextColor3 = EnsureValue(
Props.TextColor3,
"Color3",
Expand All @@ -74,11 +69,19 @@ return function(Props: Props)
)
local TextXAlignment = EnsureValue(Props.TextXAlignment, "EnumItem", Enum.TextXAlignment.Left)
local TextYAlignment = EnsureValue(Props.TextYAlignment, "EnumItem", Enum.TextYAlignment.Top)

local RemainingCharaters = Value(-1)
local IsFocused = EnsureValue(Props.IsFocused, "boolean", false)
local OnFocused = EnsureValue(Props.OnFocused, "function", function() end)
local OnFocusLost = EnsureValue(Props.OnFocusLost, "function", function() end)
local TextTransparency = EnsureValue(
Props.TextTransparency,
"number",
Computed(function()
if Disabled:get() then
return 0.75
elseif IsFocused:get() then
return 0
else
return 0.5
end
end)
)

local Observers = {
Observer(Text):onChange(function()
Expand Down Expand Up @@ -133,14 +136,15 @@ return function(Props: Props)
[Cleanup] = Observers,
}))) {
Text = Text,
TextColor3 = TextColor3,
TextColor3 = Spring(TextColor3, Themer.Theme.SpringSpeed["1"], Themer.Theme.SpringDampening),
TextSize = TextSize,
FontFace = FontFace,
PlaceholderColor3 = PlaceholderColor3,
PlaceholderText = PlaceholderText,
TextXAlignment = TextXAlignment,
TextYAlignment = TextYAlignment,
ClearTextOnFocus = ClearTextOnFocus,
TextTransparency = Spring(TextTransparency, Themer.Theme.SpringSpeed["1"], Themer.Theme.SpringDampening),
MultiLine = Props.MultiLine,
TextWrapped = Props.TextWrapped,

Expand Down

0 comments on commit 98c8d2c

Please sign in to comment.