Anne31415 commited on
Commit
fe65fa7
·
1 Parent(s): f4d7a71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -26,10 +26,9 @@ pdf_file_path = "Private_Book/KOMBI_all2.pdf" # Replace with your PDF file path
26
  def cloud_button(label, key=None, color=None):
27
  button_id = f"cloud-button-{key or label}"
28
  color_class = f"color-{color}" if color else ""
29
- num_circles = max(3, min(12, len(label) // 4)) # Adjust the number of circles based on text length
30
  circle_size = 60
31
 
32
- # Generate circles
33
  circles_html = ''.join([
34
  f'<div class="circle {color_class}"></div>' for _ in range(num_circles)
35
  ])
@@ -50,8 +49,8 @@ def cloud_button(label, key=None, color=None):
50
  .wrapper {{
51
  display: flex;
52
  align-items: center;
53
- background-color: #9BBEFF;
54
- border-radius: 30px; # Adjust as needed
55
  padding: 10px 20px;
56
  }}
57
  .text {{
@@ -60,11 +59,11 @@ def cloud_button(label, key=None, color=None):
60
  z-index: 2;
61
  }}
62
  .circle {{
63
- background-color: #9BBEFF;
64
  border-radius: 50%;
65
  width: {circle_size}px;
66
  height: {circle_size}px;
67
- margin: 0 -{circle_size // 4}px; # Adjust negative margin for overlap
68
  z-index: 1;
69
  }}
70
  .color-1 .wrapper, .color-1 .circle {{ background-color: #FFA07A; }}
@@ -79,6 +78,7 @@ def cloud_button(label, key=None, color=None):
79
  """
80
  st.markdown(cloud_button_html, unsafe_allow_html=True)
81
 
 
82
  cloud_button("Short Text", color="1")
83
  cloud_button("This is a longer piece of text", color="2")
84
  cloud_button("This is an even longer piece of text to test the cloud button", color="3")
 
26
  def cloud_button(label, key=None, color=None):
27
  button_id = f"cloud-button-{key or label}"
28
  color_class = f"color-{color}" if color else ""
29
+ num_circles = max(3, min(12, len(label) // 4))
30
  circle_size = 60
31
 
 
32
  circles_html = ''.join([
33
  f'<div class="circle {color_class}"></div>' for _ in range(num_circles)
34
  ])
 
49
  .wrapper {{
50
  display: flex;
51
  align-items: center;
52
+ background-color: transparent;
53
+ border-radius: 30px;
54
  padding: 10px 20px;
55
  }}
56
  .text {{
 
59
  z-index: 2;
60
  }}
61
  .circle {{
62
+ background-color: transparent;
63
  border-radius: 50%;
64
  width: {circle_size}px;
65
  height: {circle_size}px;
66
+ margin: 0 -{circle_size // 4}px;
67
  z-index: 1;
68
  }}
69
  .color-1 .wrapper, .color-1 .circle {{ background-color: #FFA07A; }}
 
78
  """
79
  st.markdown(cloud_button_html, unsafe_allow_html=True)
80
 
81
+
82
  cloud_button("Short Text", color="1")
83
  cloud_button("This is a longer piece of text", color="2")
84
  cloud_button("This is an even longer piece of text to test the cloud button", color="3")