From b2250680c98be2fc8e790a57f223a321d618f025 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Mon, 21 Aug 2023 12:38:17 +0800 Subject: [PATCH] Make the design more compact Signed-off-by: Egor Savkin --- sass/css/_shop.scss | 19 +++++++++++++++++-- static/js/shop_components.jsx | 8 ++++---- static/js/shop_data.js | 9 +-------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/sass/css/_shop.scss b/sass/css/_shop.scss index 637ad6c..f371b48 100644 --- a/sass/css/_shop.scss +++ b/sass/css/_shop.scss @@ -512,7 +512,7 @@ button { top: 0; width: 100%; min-height: 70px; - max-height: 350px; + max-height: 320px; overflow-y: scroll; position: absolute; display: flex; @@ -530,7 +530,22 @@ button { } div { - margin: 0 0.2rem; + margin: 0.1rem 0.2rem; + font-size: 0.75rem; + + input { + padding: 0; + font-size: 0.75rem; + line-height: 1.1; + } + + label { + margin-bottom: 0.1rem; + } + } + + .form-check { + min-height: 1rem; } } diff --git a/static/js/shop_components.jsx b/static/js/shop_components.jsx index dca4728..d1aeeb8 100644 --- a/static/js/shop_components.jsx +++ b/static/js/shop_components.jsx @@ -36,7 +36,7 @@ class Radio extends Component { let key = this.props.id + this.props.outvar; return (
- {this.props.title} +
{this.props.title}
{this.props.variants.map((variant, _) => (
-
); @@ -186,7 +186,7 @@ class SwitchLine extends Component { handleCheck() { // Update the state object with the new value for outvar let new_state = { - text: !this.state.checked ? this.state.text : "", + ...this.state, checked: !this.state.checked } this.setState(new_state); @@ -211,7 +211,7 @@ class SwitchLine extends Component { {this.props.title}
- ); diff --git a/static/js/shop_data.js b/static/js/shop_data.js index d100c4a..0326d3e 100644 --- a/static/js/shop_data.js +++ b/static/js/shop_data.js @@ -79,14 +79,7 @@ const shop_data = { {type: "Line", args: {title: "IPv4", outvar: "ipv4", fallback: "192.168.1.75/24"}}, {type: "SwitchLine", args: {title: "IPv6", outvar: "ipv6"}}, {type: "SwitchLine", args: {title: "MAC", outvar: "mac"}}, - {type: "Switch", args: {title: "Ext CLK", outvar: "ext_clk"}}, - { - "if": [ - {"===": [{"var": "ext_clk"}, true]}, - {type: "Line", args: {title: "Frequency", outvar: "ext_clk_freq", fallback: "125 MHz"}}, - null - ] - } + {type: "SwitchLine", args: {title: "Ext CLK", outvar: "ext_clk", fallback: {text: "125 MHz", checked: false}}}, ], null ]