1
1
import Roact from "@rbxts/roact" ;
2
2
import { SpecialControls , WithControls } from "@rbxts/ui-labs" ;
3
- import { EnumList , Number , RGBA } from "@rbxts/ui-labs/out/ControlsUtil" ;
3
+ import { Choose , EnumList , Number , RGBA , Slider } from "@rbxts/ui-labs/out/ControlsUtil" ;
4
4
5
5
const controls = {
6
6
"Text Label" : "String test" ,
7
7
Rounded : true ,
8
- EnumList : EnumList (
9
- {
10
- Small : 10 ,
11
- Medium : 15 ,
12
- Large : 20 ,
13
- } ,
14
- "Medium" ,
15
- ) ,
8
+ ChooseList : Choose ( [ "One" , "Two" , "Three" ] ) ,
16
9
"Text Color" : EnumList (
17
10
{
18
11
White : Color3 . fromRGB ( 255 , 255 , 255 ) ,
@@ -22,19 +15,19 @@ const controls = {
22
15
} ,
23
16
"White" ,
24
17
) ,
18
+ RoundSize : EnumList (
19
+ {
20
+ Small : new UDim ( 0 , 10 ) ,
21
+ Medium : new UDim ( 0 , 20 ) ,
22
+ Large : new UDim ( 0 , 30 ) ,
23
+ } ,
24
+ "Small" ,
25
+ ) ,
25
26
"Back Color" : RGBA ( Color3 . fromRGB ( 59 , 59 , 59 ) , 0 ) ,
26
27
//"Text Color": Color3.fromRGB(255, 255, 255),
27
28
//"Back Color": Color3.fromRGB(59, 59, 59),
28
29
"Box Size" : Number ( 200 , new NumberRange ( 5 , 400 ) , 1 , true ) ,
29
- "Text Size" : identity < SpecialControls [ "Slider" ] > ( {
30
- ControlType : "Slider" ,
31
- Default : 30 ,
32
- Props : {
33
- Min : 20 ,
34
- Max : 60 ,
35
- Step : 5 ,
36
- } ,
37
- } ) ,
30
+ "Text Size" : Slider ( 30 , 20 , 60 , 5 ) ,
38
31
} ;
39
32
40
33
const returner : WithControls < typeof controls > = {
@@ -45,22 +38,20 @@ const returner: WithControls<typeof controls> = {
45
38
story : ( props ) => {
46
39
return (
47
40
< frame
48
- Size = { UDim2 . fromOffset ( props . Controls [ "Box Size" ] , 120 ) }
49
- BackgroundColor3 = { props . Controls [ "Back Color" ] . Color }
41
+ Size = { UDim2 . fromOffset ( props . controls [ "Box Size" ] , 120 ) }
42
+ BackgroundColor3 = { props . controls [ "Back Color" ] . Color }
50
43
Position = { UDim2 . fromScale ( 0.5 , 0.5 ) }
51
44
BorderSizePixel = { 0 }
52
- BackgroundTransparency = { props . Controls [ "Back Color" ] . Transparency }
45
+ BackgroundTransparency = { props . controls [ "Back Color" ] . Transparency }
53
46
AnchorPoint = { new Vector2 ( 0.5 , 0.5 ) }
54
47
>
55
- < uicorner
56
- CornerRadius = { props . Controls . Rounded ? new UDim ( 0 , props . Controls . EnumList ) : new UDim ( 0 , 0 ) }
57
- > </ uicorner >
48
+ < uicorner CornerRadius = { props . controls . Rounded ? props . controls . RoundSize : new UDim ( 0 , 0 ) } > </ uicorner >
58
49
< textlabel
59
- TextColor3 = { props . Controls [ "Text Color" ] }
60
- TextSize = { props . Controls [ "Text Size" ] * 0.5 }
50
+ TextColor3 = { props . controls [ "Text Color" ] }
51
+ TextSize = { props . controls [ "Text Size" ] * 0.5 }
61
52
Size = { UDim2 . fromScale ( 1 , 1 ) }
62
53
BackgroundTransparency = { 1 }
63
- Text = { props . Controls [ "Text Label" ] }
54
+ Text = { props . controls [ "Text Label" ] }
64
55
> </ textlabel >
65
56
</ frame >
66
57
) ;
0 commit comments