Skip to content

Commit

Permalink
Add height as optional parameter to banner image (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer authored Nov 4, 2019
1 parent 8a17e2b commit 9194359
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 10 additions & 2 deletions webviz_config/containers/_banner_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,25 @@ class BannerImage(WebvizContainerABC):
* `title`: Title which will be overlayed over the banner image.
* `color`: Color to be used for the font.
* `shadow`: Set to `False` if you do not want text shadow for the title.
* `height`: Height of the banner image (in pixels).
"""

TOOLBAR_BUTTONS = []

def __init__(
self, image: Path, title: str = "", color: str = "white", shadow: bool = True
self,
image: Path,
title: str = "",
color: str = "white",
shadow: bool = True,
height: int = 300,
):

self.image = image
self.title = title
self.color = color
self.shadow = shadow
self.height = height

self.image_url = WEBVIZ_ASSETS.add(image)

Expand All @@ -37,7 +44,8 @@ def layout(self):

style = {
"color": self.color,
"background-image": "url({})".format(self.image_url),
"background-image": f"url({self.image_url})",
"height": f"{self.height}px",
}

if self.shadow:
Expand Down
1 change: 0 additions & 1 deletion webviz_config/static/assets/webviz_config.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

text-shadow: 0.05em 0.05em 0 rgba(0, 0, 0, 0.7);

height: 300px;
width: 100%;

margin-bottom: 25px;
Expand Down

0 comments on commit 9194359

Please sign in to comment.