text.rs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. use dioxus::prelude::*;
  2. fn main() {
  3. rink::launch(app);
  4. // rink::launch_cfg(
  5. // app,
  6. // rink::Config {
  7. // rendering_mode: rink::RenderingMode::Ansi,
  8. // },
  9. // )
  10. }
  11. fn app(cx: Scope) -> Element {
  12. let (alpha, set_alpha) = use_state(&cx, || 100);
  13. cx.render(rsx! {
  14. div {
  15. width: "100%",
  16. height: "100%",
  17. flex_direction: "column",
  18. // justify_content: "center",
  19. // align_items: "center",
  20. // flex_direction: "row",
  21. onwheel: move |evt| {
  22. set_alpha((alpha + evt.data.delta_y as i64).min(100).max(0));
  23. },
  24. p {
  25. background_color: "black",
  26. flex_direction: "column",
  27. justify_content: "center",
  28. align_items: "center",
  29. // height: "10%",
  30. color: "green",
  31. "hi"
  32. "hi"
  33. "hi"
  34. }
  35. li {
  36. background_color: "red",
  37. flex_direction: "column",
  38. justify_content: "center",
  39. align_items: "center",
  40. // height: "10%",
  41. "bib"
  42. "bib"
  43. "bib"
  44. "bib"
  45. "bib"
  46. "bib"
  47. "bib"
  48. "bib"
  49. }
  50. li {
  51. background_color: "blue",
  52. flex_direction: "column",
  53. justify_content: "center",
  54. align_items: "center",
  55. // height: "10%",
  56. "zib"
  57. "zib"
  58. "zib"
  59. "zib"
  60. "zib"
  61. "zib"
  62. }
  63. p {
  64. background_color: "yellow",
  65. "asd"
  66. }
  67. p {
  68. background_color: "green",
  69. "asd"
  70. }
  71. p {
  72. background_color: "white",
  73. "asd"
  74. }
  75. p {
  76. background_color: "cyan",
  77. "asd"
  78. }
  79. div {
  80. font_weight: "bold",
  81. color: "#666666",
  82. p {
  83. "bold"
  84. }
  85. p {
  86. font_weight: "normal",
  87. " normal"
  88. }
  89. }
  90. p {
  91. font_style: "italic",
  92. color: "red",
  93. "italic"
  94. }
  95. p {
  96. text_decoration: "underline",
  97. color: "rgba(255, 255, 255)",
  98. "underline"
  99. }
  100. p {
  101. text_decoration: "line-through",
  102. color: "hsla(10, 100%, 70%)",
  103. "line-through"
  104. }
  105. div{
  106. position: "absolute",
  107. top: "1px",
  108. background_color: "rgba(255, 0, 0, 50%)",
  109. width: "100%",
  110. p {
  111. color: "rgba(255, 255, 255, {alpha}%)",
  112. background_color: "rgba(100, 100, 100, {alpha}%)",
  113. "rgba(255, 255, 255, {alpha}%)"
  114. }
  115. p {
  116. color: "rgba(255, 255, 255, 100%)",
  117. "rgba(255, 255, 255, 100%)"
  118. }
  119. }
  120. }
  121. })
  122. }