File size: 3,279 Bytes
47e514c
 
 
 
 
 
 
ca6770c
 
 
 
 
 
 
 
 
47e514c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90f76ce
47e514c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import mesop as me

COLOR_BLUE = "blue"
COLOR_YELLOW = "#f0cd6e"
COLOR_RED = "#cc153c"
COLOR_DISABLED_BG = "#ccc"

LOADING_PAGE = me.Style(
  background=COLOR_BLUE,
  color=COLOR_YELLOW,
  display="flex",
  align_items="center",
  justify_content="center",
  height="100vh"
)

MAIN_COL_GRID = me.Style(
  background="#ececec",
  display="grid",
  grid_template_columns="70% 30%",
  height="100vh",
)

BOARD_COL_GRID = me.Style(
  background="#000",
  display="grid",
  gap="5px",
  grid_template_columns="repeat(6, 1fr)",
)

CATEGORY_BOX = me.Style(
  background=COLOR_BLUE,
  color="white",
  font_weight="bold",
  font_size="1em",
  padding=me.Padding.all(15),
  text_align="center",
)

CLUE_BOX = me.Style(
  background=COLOR_BLUE,
  color=COLOR_YELLOW,
  cursor="pointer",
  font_size="1em",
  font_weight="bold",
  padding=me.Padding.all(15),
  text_align="center",
)

SIDEBAR = me.Style(
  color="#111",
  overflow_y="scroll",
  padding=me.Padding.all(20),
)

SIDEBAR_SECTION = me.Style(margin=me.Margin(bottom=15))

SCORE_BOX = me.Style(
  background=COLOR_BLUE,
  color="white",
  font_weight="bold",
  font_size="2.2vw",
  padding=me.Padding.all(15),
  text_align="center",
)

CURRENT_CLUE_BOX = me.Style(
  background=COLOR_BLUE,
  color=COLOR_YELLOW,
  font_size="1em",
  font_weight="bold",
  padding=me.Padding.all(15),
)

RESPONSE_INPUT = me.Style(width="100%")

SELECT_CLUE_BOX = me.Style(
  background=COLOR_BLUE,
  color="white",
  padding=me.Padding.all(15),
  margin=me.Margin(bottom=20),
)

MODAL_GRID = me.Style(
  align_items="center",
  display="grid",
  height="100vh",
  justify_items="center",
)

MODAL_CONTAINER = me.Style(
  background="#ececec",
  border_radius="15px",
  box_sizing="content-box",
  box_shadow=("0 3px 1px -2px #0003, 0 2px 2px #00000024, 0 1px 5px #0000001f"),
  color="#222",
  font_size="18px",
  line_height="1.3",
  width="min(500px, 100%)",
)

MODAL_CONTENT = me.Style(margin=me.Margin.all(20))

MODAL_HEADER = me.Style(display="flex", justify_content="space-between")


def modal_background(modal_open: bool) -> me.Style:
  """Makes style for modal background.

  Args:
    modal_open: Whether the modal is open.
  """
  return me.Style(
    background="rgba(0,0,0,0.4)",
    display="block" if modal_open else "none",
    height="100%",
    overflow_x="auto",
    overflow_y="auto",
    position="fixed",
    width="100%",
    z_index=1000,
  )


def clue_box(is_selectable: bool) -> me.Style:
  """Style for clue box

  Args:
    is_selectable: Visual signify if the clue is selectable.
  """
  return me.Style(
    background=COLOR_BLUE,
    color=COLOR_YELLOW,
    cursor="pointer" if is_selectable else "default",
    font_size="1em",
    font_weight="bold",
    padding=me.Padding.all(15),
    text_align="center"
  )


def response_button(disabled: bool) -> me.Style:
  """Styles for response submit button.

  Args:
    disabled: Since we're overriding the style, we need to handle disabled state
  """
  if disabled:
    return me.Style(background=COLOR_DISABLED_BG, color="#eee")
  return me.Style(background=COLOR_BLUE, color="white")


def score_text(score: int) -> me.Style:
  """In Jeopardy when the score is negative, it is red instead of white."""
  return me.Style(color="white" if score >= 0 else COLOR_RED)