update ui
This commit is contained in:
parent
d21682999c
commit
2a78f33239
15 changed files with 361 additions and 193 deletions
70
src/ReplicatedStorage/ui/components/surface.tsx
Normal file
70
src/ReplicatedStorage/ui/components/surface.tsx
Normal file
|
@ -0,0 +1,70 @@
|
|||
import Roact from "@rbxts/roact"
|
||||
import Canvas from "./canvas"
|
||||
import Acrylic from "./acrylic"
|
||||
import Fill from "./fill"
|
||||
import { BindingOrValue } from "ReplicatedStorage/utils/bindingUtil"
|
||||
|
||||
interface surfaceProps extends Roact.JsxInstanceProperties<Frame> {
|
||||
size: BindingOrValue<UDim2>
|
||||
position: BindingOrValue<UDim2>
|
||||
ratio?: BindingOrValue<number>
|
||||
color?: BindingOrValue<Color3>
|
||||
blur?: BindingOrValue<boolean>
|
||||
[Roact.Children]?: Roact.Children
|
||||
|
||||
Event?: Roact.JsxInstanceEvents<Frame>
|
||||
Change?: Roact.JsxInstanceChangeEvents<Frame>
|
||||
}
|
||||
|
||||
function surface(props: surfaceProps): Roact.Element {
|
||||
const { size, position, ratio, color, blur } = props
|
||||
|
||||
const spreadableProps = { ...props } as Partial<surfaceProps>
|
||||
delete spreadableProps.size
|
||||
delete spreadableProps.position
|
||||
delete spreadableProps.ratio
|
||||
delete spreadableProps.color
|
||||
delete spreadableProps.blur
|
||||
delete spreadableProps[Roact.Children]
|
||||
|
||||
return (
|
||||
<Canvas
|
||||
{...spreadableProps}
|
||||
Key={"surface container"}
|
||||
size={size}
|
||||
position={position}
|
||||
>
|
||||
<>
|
||||
{
|
||||
ratio !== undefined && <uiaspectratioconstraint
|
||||
AspectRatio={ratio}
|
||||
/>
|
||||
}
|
||||
</>
|
||||
|
||||
<>
|
||||
{
|
||||
blur !== false && <Acrylic
|
||||
Key={"acrylic"}
|
||||
radius={5}
|
||||
distance={0.001}
|
||||
/>
|
||||
}
|
||||
</>
|
||||
|
||||
<Fill
|
||||
color={color ? color : Color3.fromHex("#1e1e2e")}
|
||||
transparency={.3}
|
||||
radius={5}
|
||||
/>
|
||||
|
||||
<Canvas
|
||||
Key={"inner content"}
|
||||
>
|
||||
{props[Roact.Children]}
|
||||
</Canvas>
|
||||
</Canvas>
|
||||
)
|
||||
}
|
||||
|
||||
export default surface
|
Loading…
Add table
Add a link
Reference in a new issue