Skip to content

Commit f6a86ab

Browse files
committed
graphics: main optimizations
1 parent cb62b17 commit f6a86ab

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
docs-build/
23
coverage/
34
build/
45
debug.log

src/UsageBarDark.stories.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,42 @@ const items = [
3131
},
3232
]
3333

34+
const mainDarkModeContainerStyle = { backgroundColor: "#212121", padding: 16 }
35+
3436
export const darkMode = () => (
35-
<div style={{ backgroundColor: "#212121" }}>
37+
<div style={mainDarkModeContainerStyle}>
3638
<UsageBar darkMode items={items} total={100} />
3739
</div>
3840
)
3941

4042
export const darkModeWithoutLabels = () => (
41-
<div style={{ backgroundColor: "#212121" }}>
43+
<div style={mainDarkModeContainerStyle}>
4244
<UsageBar removeLabels darkMode items={items} total={100} />
4345
</div>
4446
)
4547

4648
export const darkModeWithPercentages = () => (
47-
<div style={{ backgroundColor: "#212121" }}>
49+
<div style={mainDarkModeContainerStyle}>
4850
<UsageBar showPercentage darkMode items={items} total={100} />
4951
</div>
5052
)
5153

5254
export const darkModeCompact = () => (
53-
<div style={{ backgroundColor: "#212121" }}>
55+
<div style={mainDarkModeContainerStyle}>
5456
<UsageBar showPercentage compactLayout darkMode items={items} total={100} />
5557
</div>
5658
)
5759

5860
export const darkModeCompactWithoutLabels = () => (
59-
<div style={{ backgroundColor: "#212121" }}>
61+
<div style={mainDarkModeContainerStyle}>
6062
<UsageBar removeLabels compactLayout darkMode items={items} total={100} />
6163
</div>
6264
)
6365

6466
export const error = () => (
6567
<>
6668
<p>If sum of values exceeds total.</p>
67-
<div style={{ backgroundColor: "#212121" }}>
69+
<div style={mainDarkModeContainerStyle}>
6870
<UsageBar items={items} total={50} />
6971
</div>
7072
</>

src/index.css

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
.u-UsageBar-dark {
2121
--text-color: hsl(0, 0%, 13%);
2222
--background-tooltip-color: hsl(0, 0%, 100%);
23-
--background-bar-color: hsl(0, 0%, 30%);
23+
--background-bar-color: hsl(0, 0%, 25%);
2424
}
2525

2626
.c-UsageBar {
27-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
28-
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
29-
sans-serif;
27+
font-family: sans-serif;
3028
-webkit-font-smoothing: antialiased;
3129
-moz-osx-font-smoothing: grayscale;
3230
display: flex;
@@ -37,7 +35,6 @@
3735
background-color: inherit;
3836
color: inherit;
3937
font-size: 1em;
40-
padding: 8pt;
4138
position: relative;
4239
height: 60pt;
4340
width: 100%;
@@ -127,24 +124,23 @@
127124
.o-UsageBar__compact__bar {
128125
max-width: 500px;
129126
}
127+
.o-UsageBar__bar__elements__labels__container,
128+
.o-UsageBar__bar__elements__label {
129+
display: flex;
130+
justify-content: flex-start;
131+
align-items: center;
132+
flex-direction: row;
133+
}
130134
.o-UsageBar__bar__elements__labels__container {
131135
margin-top: 12pt;
132136
position: relative;
133137
width: 100%;
134138
max-width: 480px;
135-
display: flex;
136-
justify-content: flex-start;
137-
align-items: center;
138-
flex-direction: row;
139139
flex-wrap: wrap;
140140
gap: 12pt;
141141
font-size: 0.9em;
142142
}
143143
.o-UsageBar__bar__elements__label {
144-
display: flex;
145-
justify-content: flex-start;
146-
align-items: center;
147-
flex-direction: row;
148144
flex-wrap: nowrap;
149145
}
150146
.o-UsageBar__bar__elements__label > span,

0 commit comments

Comments
 (0)