Skip to content

Commit aedcbbb

Browse files
authored
style: User less CSS to achieve a more stable layout (#111)
* style: User less CSS to achieve a more stable layout * style: Force column on leg pattern sliders
1 parent 1aba32e commit aedcbbb

File tree

3 files changed

+22
-29
lines changed

3 files changed

+22
-29
lines changed

src/components/generic/Slider.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { RANGE_PARAMS } from "../vars"
1313
* */
1414
const Slider = ({ name, id, value, rangeParams, handleChange }) => (
1515
<div className="slider-container cell">
16-
<span className="label">
17-
<label htmlFor={id || name}>{name}</label> : {value}
18-
</span>
16+
<div className="label">
17+
<label htmlFor={id || name}>{name}</label> : <span>{value}</span>
18+
</div>
1919
<input
2020
type="range"
2121
id={id || name}

src/components/pages/LegPatternPage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class LegPatternPage extends Component {
3939

4040
render = () => (
4141
<Card title={this.pageName} h="h2">
42-
<div className="row-container">{this.sliders}</div>
42+
<div className="leg-sliders-container">{this.sliders}</div>
4343
<BasicButton handleClick={this.reset}>{RESET_LABEL}</BasicButton>
4444
</Card>
4545
)

src/index.css

+18-25
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,20 @@ input[type="number"] {
235235
}
236236

237237
.label {
238+
width: 100%;
238239
font-size: 0.6rem;
239240
margin-left: 5px;
240241
opacity: 0.5;
242+
white-space: nowrap;
241243
}
242244

243245
.no-display {
244246
display: none;
245247
}
246248

247-
.row-container {
249+
.row-container,
250+
.leg-sliders-container {
248251
display: flex;
249-
flex-wrap: unset;
250252
}
251253

252254
.flex-wrap {
@@ -268,7 +270,6 @@ input[type="number"] {
268270

269271
.slider {
270272
-webkit-appearance: none;
271-
width: 100%;
272273
height: 4px;
273274
border: 0px;
274275
border-radius: 5px;
@@ -322,6 +323,7 @@ input[type="number"] {
322323

323324
.switch + .label {
324325
cursor: pointer;
326+
width: unset;
325327
}
326328

327329
/* Hide default HTML checkbox */
@@ -409,12 +411,12 @@ input:checked + .toggle-switch-widget:before {
409411
flex-grow: 0;
410412
}
411413

412-
.row-container {
413-
flex-wrap: wrap;
414+
.leg-sliders-container {
415+
flex-direction: column;
414416
}
415417

416418
.slider-container.cell {
417-
flex: auto;
419+
flex: 1;
418420
}
419421

420422
th,
@@ -431,21 +433,20 @@ input:checked + .toggle-switch-widget:before {
431433
}
432434

433435
.main {
434-
flex-direction: column;
436+
flex-direction: column-reverse;
435437
margin: 0;
436438
}
437439

438440
.sidebar {
439441
max-width: 600px;
440-
width: 100%;
441-
order: 1;
442-
margin-right: 0;
442+
width: 90%;
443+
min-width: 290px;
444+
margin: 0 auto;
443445
}
444446

445447
.plot {
446448
width: 100%;
447449
height: 400px;
448-
order: 0;
449450
box-sizing: border-box;
450451
margin: 0;
451452
margin-top: 5px;
@@ -454,16 +455,17 @@ input:checked + .toggle-switch-widget:before {
454455

455456
@media screen and (max-width: 667px) and (orientation: landscape) {
456457
.main {
457-
flex-direction: column;
458+
flex-direction: column-reverse;
458459
margin: 0;
459460
}
460461

461462
.sidebar {
462463
min-width: 225px;
464+
margin: 0 auto;
463465
}
464466

465467
.plot {
466-
margin: 0 auto;
468+
margin: 8px auto 0;
467469
width: 90%;
468470
height: 275px;
469471
min-width: 250px;
@@ -473,16 +475,12 @@ input:checked + .toggle-switch-widget:before {
473475
flex-grow: 0;
474476
}
475477

476-
.nav {
477-
display: none;
478-
}
479-
480-
.row-container {
481-
flex-wrap: wrap;
478+
.leg-sliders-container {
479+
flex-direction: column;
482480
}
483481

484482
.slider-container.cell {
485-
flex: auto;
483+
flex: 1;
486484
}
487485

488486
table {
@@ -496,11 +494,6 @@ input:checked + .toggle-switch-widget:before {
496494
padding-top: 10px;
497495
padding-bottom: 10px;
498496
}
499-
500-
.top-bar {
501-
display: none;
502-
height: 10px;
503-
}
504497
}
505498

506499
@media screen and (max-width: 767px) {

0 commit comments

Comments
 (0)