From 057efc9a8c935150fc9d97a662a8ea409d01516c Mon Sep 17 00:00:00 2001 From: reidlab Date: Sun, 20 Aug 2023 19:52:02 -0700 Subject: [PATCH] update ui --- .../ui/components/surface.tsx | 25 +++---- .../StarterPlayerScripts/ui/config/config.tsx | 71 +++++++------------ .../ui/config/item.story.tsx | 25 ------- .../StarterPlayerScripts/ui/config/item.tsx | 4 +- .../StarterPlayerScripts/ui/hotbar/slot.tsx | 1 + .../StarterPlayerScripts/ui/main.tsx | 6 -- 6 files changed, 39 insertions(+), 93 deletions(-) delete mode 100644 src/StarterPlayer/StarterPlayerScripts/ui/config/item.story.tsx diff --git a/src/ReplicatedStorage/ui/components/surface.tsx b/src/ReplicatedStorage/ui/components/surface.tsx index 25f2a8f..e5c2c33 100644 --- a/src/ReplicatedStorage/ui/components/surface.tsx +++ b/src/ReplicatedStorage/ui/components/surface.tsx @@ -9,7 +9,7 @@ interface surfaceProps extends Roact.JsxInstanceProperties { position: BindingOrValue ratio?: BindingOrValue color?: BindingOrValue - blur?: BindingOrValue + anchor?: Vector2 [Roact.Children]?: Roact.Children Event?: Roact.JsxInstanceEvents @@ -17,14 +17,14 @@ interface surfaceProps extends Roact.JsxInstanceProperties { } function surface(props: surfaceProps): Roact.Element { - const { size, position, ratio, color, blur } = props + const { size, position, ratio, color, anchor } = props const spreadableProps = { ...props } as Partial delete spreadableProps.size delete spreadableProps.position delete spreadableProps.ratio delete spreadableProps.color - delete spreadableProps.blur + delete spreadableProps.anchor delete spreadableProps[Roact.Children] return ( @@ -33,24 +33,19 @@ function surface(props: surfaceProps): Roact.Element { Key={"surface container"} size={size} position={position} + anchor={anchor} > <> { - ratio !== undefined && + ratio !== undefined && } - <> - { - blur !== false && - } - + { shown: boolean @@ -13,8 +13,8 @@ interface ConfigProps extends Roact.JsxInstanceProperties { Change?: Roact.JsxInstanceChangeEvents } -const CONFIG_DEFAULT = [new Spring(1.5, { frequency: 6 }), new Spring(0, { frequency: 6 })] -const CONFIG_ACTIVE = [new Spring(.5, { frequency: 6 }), new Spring(1, { frequency: 6 })] +const CONFIG_DEFAULT = [new Spring(1.5, { frequency: 6 })] +const CONFIG_ACTIVE = [new Spring(.5, { frequency: 6 })] function config(props: ConfigProps): Roact.Element { let { shown } = props @@ -22,11 +22,8 @@ function config(props: ConfigProps): Roact.Element { const spreadableProps = { ...props } as Partial delete spreadableProps.shown - const [configPosYAndBorderColor, setConfigGoal] = useGroupMotor([1.5, 6]) - const configPosY = configPosYAndBorderColor.map((t) => t[0]) - const configBorderColor = configPosYAndBorderColor.map((t) => t[1]).map((val) => { - return Color3.fromHex("#6c7086").Lerp(Color3.fromHex("#b4befe"), val) - }) + const [configPosYMap, setConfigGoal] = useGroupMotor([1.5]) + const configPosY = configPosYMap.map((t) => t[0]) useEffect(() => { const guid = HttpService.GenerateGUID(false) @@ -48,50 +45,34 @@ function config(props: ConfigProps): Roact.Element { }) return ( - { return new UDim2(.5, 0, posY, 0) }) } - BackgroundTransparency={1} - Size={new UDim2(.4, 0, .7, 0)} - Key={"Config"} + size={new UDim2(.4, 0, .7, 0)} + Key={"config"} > - - - - - - - - + + + ) } diff --git a/src/StarterPlayer/StarterPlayerScripts/ui/config/item.story.tsx b/src/StarterPlayer/StarterPlayerScripts/ui/config/item.story.tsx deleted file mode 100644 index 015afb4..0000000 --- a/src/StarterPlayer/StarterPlayerScripts/ui/config/item.story.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import Roact from "@rbxts/roact" -import { withHookDetection } from "@rbxts/roact-hooked" -import { ReflexProvider, useSelector } from "@rbxts/roact-reflex" -import { producer } from "ReplicatedStorage/ui/store/producer" -import Item from "./item" - -export = (target: Frame) => { - withHookDetection(Roact) - - const tree = Roact.mount( - - - , - target - ) - - return () => { - Roact.unmount(tree) - } -} \ No newline at end of file diff --git a/src/StarterPlayer/StarterPlayerScripts/ui/config/item.tsx b/src/StarterPlayer/StarterPlayerScripts/ui/config/item.tsx index bb7fdf5..9ec7ae4 100644 --- a/src/StarterPlayer/StarterPlayerScripts/ui/config/item.tsx +++ b/src/StarterPlayer/StarterPlayerScripts/ui/config/item.tsx @@ -29,12 +29,12 @@ function item(props: itemProps): Roact.Element { delete spreadableProps.action return ( - +