Skip to content

Commit

Permalink
adjust margin for NumberBox (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
pplonski committed May 29, 2023
1 parent f8b0649 commit 22d8bf8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mercury/apps/tasks/tasks_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from apps.tasks.export_pdf import to_pdf


@shared_task(bind=True)
@shared_task(bind=True, ignore_result=False)
def export_to_pdf(self, job_params):
notebook_id = job_params.get("notebook_id")
notebook_path = job_params.get("notebook_path")
Expand Down
11 changes: 7 additions & 4 deletions mercury/widgets/numberbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ def _repr_html_(self):
bloxs = ""
for i, b in enumerate(self.data):
if isinstance(b, NumberBox):
b.position = i
# we dont set position for last item
# because we dont need to add margin for it
if i != len(self.data)-1:
b.position = i
bloxs += b._repr_html_()

return f"""{self.styles()}<div class="numberbox-container" style="display: flex; background: #fff">{bloxs}</div>"""
return f"""{self.styles()}<div class="numberbox-container" style="display: flex; background: #fff;">{bloxs}</div>"""

percent_change_html = ""
if self.percent_change is not None:
Expand All @@ -77,9 +80,9 @@ def _repr_html_(self):
else:
data_str = f"{self.data:,}"

margin = "0px" if self.position is None else "10px"
margin = "0px" if self.position is None else "15px"
return f"""
<div style="text-align: center; width: 100%; border: 1px solid {self.border_color}; margin: {margin}; padding-top: 40px; padding-bottom: 30px; background: {self.background_color}; border-radius:5px">
<div style="text-align: center; width: 100%; border: 1px solid {self.border_color}; margin-right: {margin}; margin-top: 15px; padding-top: 40px; padding-bottom: 30px; background: {self.background_color}; border-radius:5px">
<span style="font-size: 4em; color: {self.data_color}; font-family: monospace; ">{data_str}</span>
{percent_change_html}
{title_html}
Expand Down

0 comments on commit 22d8bf8

Please sign in to comment.