Skip to content

Commit 40ed268

Browse files
committed
update styles for stat
1 parent 79cb4c3 commit 40ed268

File tree

4 files changed

+72
-18
lines changed

4 files changed

+72
-18
lines changed

dashboards/component/stat/serializers.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ class StatSerializer(BaseStatSerializer, asset_definitions.MediaDefiningClass):
101101

102102
class Media:
103103
js = ("https://unpkg.com/feather-icons", "dashboards/js/icons.js")
104-
css = {
105-
"all": ("dashboards/css/src/stat.css",),
106-
}
107104

108105
def get_value(self) -> Any:
109106
queryset = self.get_queryset()

dashboards/static/dashboards/css/dashboards.css

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@
180180
background-color: var(--color-background-tertiary);
181181
padding: 1rem;
182182
border-bottom: solid 1px var(--color-border);
183-
border-radius: 15px 15px 0 0;
184183
}
185184

186185
.card .card-header .header-title {
@@ -245,7 +244,6 @@
245244
padding: 5px;
246245
font-size: 0.75em;
247246
background-color: var(--color-background-tertiary);
248-
border-radius: 0 0 15px 15px;
249247
}
250248

251249
.form-table {
@@ -325,8 +323,6 @@ h1, h2, h3, h4, h5, h6 {
325323

326324
hr{
327325
border-color: var(--color-text-primary);
328-
grid-column-end: span 12;
329-
width: 100%;
330326
}
331327

332328
.menu {
@@ -560,7 +556,70 @@ hr{
560556
transform: translate(-50%, -50%);
561557
}
562558

563-
.dashboard-container, .tab-content>.active {
559+
:root {
560+
--color-positive: #11cc23;
561+
--color-negative: #dc2626;
562+
--color-background: #fafafa;
563+
--color-separator: #ccc;
564+
}
565+
566+
.stat {
567+
display: flex;
568+
flex-direction: column;
569+
width: 100%;
570+
background-color: var(--color-background);
571+
}
572+
573+
.stat .stat__heading {
574+
width: 100%;
575+
display: flex;
576+
flex-flow: row wrap;
577+
justify-content: space-between;
578+
align-content: center;
579+
border-bottom: 1px solid var(--color-separator);
580+
}
581+
582+
.stat .stat__heading .stat__title {
583+
text-align: left;
584+
font-size: 1.25rem;
585+
flex: 1 1 0;
586+
}
587+
588+
.stat .stat__heading .stat__icon {
589+
flex-grow: 0;
590+
}
591+
592+
.stat .stat__body {
593+
display: flex;
594+
flex-wrap: wrap;
595+
flex-direction: column;
596+
align-content: stretch;
597+
margin-top: 0.5rem;
598+
}
599+
600+
.stat .stat__body .stat__text {
601+
font-size: 2rem;
602+
font-weight: bold;
603+
flex: 100%;
604+
margin: 0;
605+
}
606+
607+
.stat .stat__body .stat__change {
608+
flex: 100%;
609+
color: #999;
610+
margin: 0;
611+
font-size: 0.75rem;
612+
}
613+
614+
.stat .stat__body .positive {
615+
color: var(--color-positive);
616+
}
617+
618+
.stat .stat__body .negative {
619+
color: var(--color-negative);
620+
}
621+
622+
.dashboard-container {
564623
display: grid;
565624
grid-template-columns: repeat(12, 1fr);
566625
grid-gap: 1rem;
@@ -569,10 +628,14 @@ hr{
569628
width: 100%;
570629
}
571630

572-
h1, h2, h3, h4, p {
631+
h1, h2, h3, h4, p, .tab-container {
573632
grid-column: 1 / 13;
574633
}
575634

635+
.tab-content div.active .card{
636+
border-radius: 0 15px 15px 15px;
637+
}
638+
576639
.dashboard-component-inner {
577640
padding: 2rem;
578641
}
@@ -584,9 +647,8 @@ h1, h2, h3, h4, p {
584647
font-size: 1.3rem;
585648
}
586649

587-
.tab-content{}
588-
589650
.tabs {
651+
border-top: 2px var(--color-border) solid;
590652
display: flex;
591653
flex-wrap: wrap;
592654
margin-left: 0;
@@ -652,7 +714,3 @@ h1, h2, h3, h4, p {
652714
margin: auto;
653715
max-width: 65%;
654716
}
655-
656-
.loading-img{
657-
padding: 5em;
658-
}

dashboards/static/dashboards/css/src/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
@import "menu.css";
77
@import "grid.css";
88
@import "gauge.css";
9+
@import "stat.css";
910
@import "dashboards.css";

dashboards/static/dashboards/css/src/stat.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
:root {
22
--color-positive: #11cc23;
33
--color-negative: #dc2626;
4-
--color-background: #eee;
4+
--color-background: #fafafa;
55
--color-separator: #ccc;
66
}
77

@@ -10,8 +10,6 @@
1010
flex-direction: column;
1111
width: 100%;
1212
background-color: var(--color-background);
13-
border-radius: 15px;
14-
padding: 1rem;
1513
}
1614

1715
.stat .stat__heading {

0 commit comments

Comments
 (0)