Skip to content

Commit 677f96c

Browse files
Merge pull request #402 from JarvusInnovations/dash[-improve-styling]
["dash"] Improve Dash styling
2 parents c5f2c3c + 8553cd7 commit 677f96c

File tree

16 files changed

+286
-213
lines changed

16 files changed

+286
-213
lines changed

src/assets/app.css

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/assets/favicon.ico

-822 Bytes
Binary file not shown.

src/assets/penn-medicine-header.css

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/chime_dash/app/assets/app.css

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
-------------------------------------------------------------
3+
Use this file to add generic styling to the app
4+
---------------------------------------------------------
5+
*/
6+
7+
body {
8+
font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
9+
}
10+
11+
main h1 {
12+
margin-bottom: 1.5rem;
13+
}
14+
15+
main h2 {
16+
margin-bottom: 1rem;
17+
margin-top: 3rem;
18+
}
19+
20+
main h3,
21+
main h4 {
22+
margin-bottom: .75rem;
23+
margin-top: 1.5rem;
24+
}
25+
26+
/* hide spinner arrows */
27+
input[type="number"] {
28+
-moz-appearance: textfield;
29+
}
30+
31+
input[type="number"]::-webkit-inner-spin-button,
32+
input[type="number"]::-webkit-outer-spin-button {
33+
display: none;
34+
}
35+
/* end hide spinner arrows */
36+
37+
/* make Dash date picker fit in better with bootstrap styles */
38+
.form-control .SingleDatePicker {
39+
display: block;
40+
margin: -.375rem -.75rem;
41+
}
42+
43+
.form-control .SingleDatePickerInput {
44+
background: none;
45+
border: 0;
46+
display: block;
47+
}
48+
49+
.form-control .DateInput {
50+
background: none;
51+
display: block;
52+
width: auto;
53+
}
54+
55+
.form-control .DateInput_input {
56+
background: none;
57+
font: inherit;
58+
padding: .375rem .75rem;
59+
}
60+
61+
.form-control .DateInput_fang {
62+
margin-top: -.75rem;
63+
}
64+
65+
.form-control .DayPicker__withBorder {
66+
box-shadow: 0 2px 6px rgba(0,0,0,.2),
67+
0 0 0 1px rgba(0,0,0,.1);
68+
}
69+
70+
.form-control .SingleDatePicker_picker {
71+
margin-top: calc(-.75rem - 1px); /* 1px connects with pointer */
72+
}
73+
/* end date picker wrangling */

src/chime_dash/app/assets/favicon.ico

14.7 KB
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
/*
3+
------------------------------------------------------------------
4+
Place a link to this file in you source code before your site's
5+
CSS files.
6+
7+
This will allow you to make style overrides if any of the
8+
Penn Medicine Masthead CSS rules conflict with those of you site.
9+
10+
If you have questions or need assistance, contact us at
11+
12+
------------------------------------------------------------------
13+
*/
14+
15+
.penn-medicine-header {
16+
background-color: #2a3980;
17+
}
18+
19+
.penn-medicine-header__logo {
20+
background-image: url(https://www.pennmedicine.org/Assets/PennMedicine/built/images/assets/logo-white.svg);
21+
background-repeat: no-repeat;
22+
background-size: 90%;
23+
display: block;
24+
height: 33px;
25+
width: 230px;
26+
text-indent: -999999px;
27+
margin-bottom: -2px;
28+
}

src/chime_dash/app/components/__init__.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
"""Builds the root component
1+
"""Combines all components
2+
3+
The `sidebar` component combines all the inputs while other components potentially
4+
have callbacks.
5+
6+
To add or remove components, adjust the `setup`.
7+
If callbacks are present, also adjust `CALLBACK_INPUTS`, `CALLBACK_OUTPUTS` and
8+
`callback_body`.
29
"""
310
from collections import OrderedDict
411

@@ -28,6 +35,7 @@ class Body(Component):
2835
"""
2936
external_stylesheets = [
3037
BOOTSTRAP,
38+
'https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,600;1,400;1,600&display=swap',
3139
]
3240

3341
def __init__(self, language, defaults):
@@ -42,6 +50,21 @@ def __init__(self, language, defaults):
4250
)
4351

4452
def get_html(self):
53+
"""Glues individual setup components together
54+
"""
55+
return Div(
56+
className="app",
57+
children=self.components["navbar"].html + [
58+
Div(
59+
className="app-content",
60+
children=
61+
self.components["sidebar"].html
62+
+ self.components["index"].html
63+
)
64+
]
65+
)
66+
67+
def get_html_old(self):
4568
"""Glues individual setup components together
4669
"""
4770
return Div(children=

src/chime_dash/app/components/header.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def get_html(self) -> List[ComponentMeta]:
2121
content = self.content
2222
return [Div(
2323
children=[
24-
H1(className="penn-medicine-header__title", id="title", children=content["title"]),
2524
Markdown(content["description"])
2625
]
2726
)]

src/chime_dash/app/components/navbar.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,35 @@ def get_html(self) -> List[ComponentMeta]:
2929
"""Initialize the navigation bar
3030
"""
3131
nav = dbc.Navbar(
32-
children=dbc.Container(
33-
[
34-
dbc.Row(
35-
children=[
36-
html.A(
37-
href="https://www.pennmedicine.org",
38-
className="penn-medicine-header__logo",
39-
title="Go to the Penn Medicine home page",
40-
),
41-
dbc.NavbarBrand(children="CHIME", href="/"),
42-
],
43-
align="center",
44-
no_gutters=True,
32+
className="penn-medicine-header px-0",
33+
children=html.Div(
34+
className="d-flex align-items-center w-100",
35+
children=[
36+
html.Div(
37+
className="px-3",
38+
style={"width": "320px"},
39+
children=html.A(
40+
href="https://www.pennmedicine.org",
41+
className="penn-medicine-header__logo",
42+
title="Go to the Penn Medicine home page",
43+
),
4544
),
46-
]
47-
+ self.menu.html,
48-
fluid=True,
45+
html.Div(
46+
className="flex-fill",
47+
children=dbc.Container(
48+
children=[dbc.NavbarBrand(
49+
children=html.H1(
50+
style={"font": "inherit", "margin": "0"},
51+
children="COVID-19 Hospital Impact Model for Epidemics (CHIME)"
52+
),
53+
href="/"
54+
)] + self.menu.html
55+
),
56+
)
57+
],
4958
),
5059
dark=True,
5160
fixed="top",
52-
color="dark",
61+
color="",
5362
)
5463
return [nav]

0 commit comments

Comments
 (0)