11package example
22
33import cats .effect .IO
4+ import example .views .Page
45import tyrian .*
56import tyrian .next .*
67import tyrian .ui .*
8+ // import components.TopNav
79
810final case class Model (
9- topNav : TopNav ,
10- nameInput : Input
11+ // topNav: TopNav,
12+ // nameInput: Input
1113):
1214
1315 def update : GlobalMsg => Outcome [Model ] =
@@ -19,89 +21,91 @@ final case class Model(
1921 .addActions(Nav .loadUrl[IO ](href))
2022
2123 case e =>
22- for {
23- tn <- topNav.update(e)
24- ni <- nameInput.update(e)
25- } yield this .copy(
26- topNav = tn,
27- nameInput = ni
28- )
24+ Outcome (this )
25+ // for {
26+ // tn <- topNav.update(e)
27+ // ni <- nameInput.update(e)
28+ // } yield this.copy(
29+ // topNav = tn,
30+ // nameInput = ni
31+ // )
2932
3033 def view (using Theme ): HtmlFragment =
31- topNav.view |+|
32- Model .tmpView(this )
34+ Page .page
35+ // topNav.view |+|
36+ // Model.tmpView(this)
3337
3438object Model :
3539 val init : Model =
3640 Model (
37- TopNav .initial,
38- Input (UIKey (" name-input" ))
39- .withPlaceholder(" Type here..." )
40- .overrideTheme(
41- _.withTextColor(RGBA .fromHex(" #1f2937" ))
42- .withBackgroundColor(RGBA .fromHex(" #f9fafb" ))
43- .solidBorder(BorderWidth .Thin , RGBA .fromHex(" #d1d5db" ))
44- .rounded
45- .withPadding(Spacing .Small )
46- )
41+ // components. TopNav.initial,
42+ // Input(UIKey("name-input"))
43+ // .withPlaceholder("Type here...")
44+ // .overrideTheme(
45+ // _.withTextColor(RGBA.fromHex("#1f2937"))
46+ // .withBackgroundColor(RGBA.fromHex("#f9fafb"))
47+ // .solidBorder(BorderWidth.Thin, RGBA.fromHex("#d1d5db"))
48+ // .rounded
49+ // .withPadding(Spacing.Small)
50+ // )
4751 )
4852
49- def tmpView (m : Model )(using Theme ): HtmlFragment =
50- HtmlFragment (
51- Row (
52- Column (
53- TextBlock (" Welcome to Tyrian UI!" ).toHeading1
54- .overrideTheme(_.withTextColor(RGBA .fromHex(" #2563eb" ))),
55- Row (
56- Column (
57- TextBlock (" Your name:" ),
58- m.nameInput,
59- TextBlock (" Reversed: " + m.nameInput.value.reverse)
60- )
61- ).withSpacing(Spacing .Small ),
62- Row (
63- TextBlock (" Hello, Tyrian!" ).overrideTheme(_.withTextColor(RGBA .Blue )),
64- TextBlock (" More text" ).overrideTheme(_.withTextColor(RGBA .Red .mix(RGBA .Blue )))
65- )
66- .withSpacing(Spacing .Medium ),
67- TextBlock (" This is just some text" )
68- .overrideTheme(_.withTextColor(RGBA .fromHex(" #6b7280" ))),
69- HtmlElement (
70- tyrian.Html .div(
71- tyrian.Html .style := " border: 2px dashed #ccc; padding: 1rem; border-radius: 4px; margin: 1rem 0;"
72- )(
73- tyrian.Html .p(" This is arbitrary HTML embedded within the UI component system!" ),
74- tyrian.Html .strong(" Bold text" ),
75- tyrian.Html .text(" and " ),
76- tyrian.Html .em(" italic text" )
77- )
78- )
79- ),
80- Column (
81- Container (
82- TextBlock (" This is some more text." )
83- ).middle.center
84- .withPadding(Spacing .Large )
85- .overrideTheme(
86- _.rounded
87- .solidBorder(BorderWidth .Medium , RGBA .fromHex(" #10b981" ))
88- .shadowMedium(RGBA .fromHex(" #00000040" ))
89- .withBackgroundColor(RGBA .fromHex(" #ecfdf5" ))
90- .withOpacity(Opacity .High )
91- ),
92- Image (
93- " https://raw.githubusercontent.com/PurpleKingdomGames/roguelike-starterkit/417f4e372b4792972ef62aea0c917088a9fc82fd/roguelike.gif" ,
94- " Roguelike"
95- ).withSize(Extent .px(300 ), Extent .px(100 ))
96- .scaleDown
97- .overrideTheme(
98- _.rounded
99- .solidBorder(BorderWidth .Medium , RGBA .fromHex(" #2563eb" ))
100- .shadowLarge(RGBA .fromHex(" #00000080" ))
101- .withBackgroundColor(RGBA .fromHex(" #fbbf24" ))
102- .withOpacity(Opacity .Medium )
103- )
104- )
105- )
106- .withSpacing(Spacing .Large )
107- )
53+ // def tmpView(m: Model)(using Theme): HtmlFragment =
54+ // HtmlFragment(
55+ // Row(
56+ // Column(
57+ // TextBlock("Welcome to Tyrian UI!").toHeading1
58+ // .overrideTheme(_.withTextColor(RGBA.fromHex("#2563eb"))),
59+ // Row(
60+ // Column(
61+ // TextBlock("Your name:"),
62+ // m.nameInput,
63+ // TextBlock("Reversed: " + m.nameInput.value.reverse)
64+ // )
65+ // ).withSpacing(Spacing.Small),
66+ // Row(
67+ // TextBlock("Hello, Tyrian!").overrideTheme(_.withTextColor(RGBA.Blue)),
68+ // TextBlock("More text").overrideTheme(_.withTextColor(RGBA.Red.mix(RGBA.Blue)))
69+ // )
70+ // .withSpacing(Spacing.Medium),
71+ // TextBlock("This is just some text")
72+ // .overrideTheme(_.withTextColor(RGBA.fromHex("#6b7280"))),
73+ // HtmlElement(
74+ // tyrian.Html.div(
75+ // tyrian.Html.style := "border: 2px dashed #ccc; padding: 1rem; border-radius: 4px; margin: 1rem 0;"
76+ // )(
77+ // tyrian.Html.p("This is arbitrary HTML embedded within the UI component system!"),
78+ // tyrian.Html.strong("Bold text"),
79+ // tyrian.Html.text(" and "),
80+ // tyrian.Html.em("italic text")
81+ // )
82+ // )
83+ // ),
84+ // Column(
85+ // Container(
86+ // TextBlock("This is some more text.")
87+ // ).middle.center
88+ // .withPadding(Spacing.Large)
89+ // .overrideTheme(
90+ // _.rounded
91+ // .solidBorder(BorderWidth.Medium, RGBA.fromHex("#10b981"))
92+ // .shadowMedium(RGBA.fromHex("#00000040"))
93+ // .withBackgroundColor(RGBA.fromHex("#ecfdf5"))
94+ // .withOpacity(Opacity.High)
95+ // ),
96+ // Image(
97+ // "https://raw.githubusercontent.com/PurpleKingdomGames/roguelike-starterkit/417f4e372b4792972ef62aea0c917088a9fc82fd/roguelike.gif",
98+ // "Roguelike"
99+ // ).withSize(Extent.px(300), Extent.px(100))
100+ // .scaleDown
101+ // .overrideTheme(
102+ // _.rounded
103+ // .solidBorder(BorderWidth.Medium, RGBA.fromHex("#2563eb"))
104+ // .shadowLarge(RGBA.fromHex("#00000080"))
105+ // .withBackgroundColor(RGBA.fromHex("#fbbf24"))
106+ // .withOpacity(Opacity.Medium)
107+ // )
108+ // )
109+ // )
110+ // .withSpacing(Spacing.Large)
111+ // )
0 commit comments