From bb7ebe45d968ca5c8252c1a0f87683b98027dcd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 16 Apr 2024 11:54:44 +0100 Subject: [PATCH 1/5] web: Use meaningful icons in Storage proposal page Icons that intend to represent the action's concept instead of how the UI is going to present the action to the user. --- web/src/components/core/Field.jsx | 5 ++--- web/src/components/core/Field.test.jsx | 20 ++++++++----------- web/src/components/layout/Icon.jsx | 4 ++++ .../components/storage/BootConfigField.jsx | 6 +++--- .../components/storage/EncryptionField.jsx | 7 ++++--- .../storage/InstallationDeviceField.jsx | 7 ++++--- .../components/storage/PartitionsField.jsx | 1 + .../components/storage/SpacePolicyField.jsx | 9 +++++---- 8 files changed, 31 insertions(+), 28 deletions(-) diff --git a/web/src/components/core/Field.jsx b/web/src/components/core/Field.jsx index 74d955733a..bc9533b0c5 100644 --- a/web/src/components/core/Field.jsx +++ b/web/src/components/core/Field.jsx @@ -108,13 +108,12 @@ const SwitchField = ({ isChecked = false, highlightContent = false, ...props }) }; /** - * @param {Omit & {isExpanded: boolean}} props + * @param {FieldProps & {isExpanded: boolean}} props */ const ExpandableField = ({ isExpanded, ...props }) => { - const iconName = isExpanded ? "collapse_all" : "expand_all"; const className = isExpanded ? "expanded" : "collapsed"; - return ; + return ; }; export default Field; diff --git a/web/src/components/core/Field.test.jsx b/web/src/components/core/Field.test.jsx index 2a07467732..af0ba3e3f2 100644 --- a/web/src/components/core/Field.test.jsx +++ b/web/src/components/core/Field.test.jsx @@ -111,19 +111,15 @@ describe("SwitchField", () => { }); describe("ExpandableField", () => { - it("uses the 'collapse_all' icon when isExpanded", () => { - const { container } = plainRender( - - ); - const icon = container.querySelector("button > svg"); - expect(icon).toHaveAttribute("data-icon-name", "collapse_all"); + it("uses 'expanded' as className prop value when isExpanded", () => { + const { container } = plainRender(); + const field = container.querySelector("[data-type='agama/field']"); + expect(field.classList.contains("expanded")).toBe(true); }); - it("uses the 'expand_all' icon when not isExpanded", () => { - const { container } = plainRender( - - ); - const icon = container.querySelector("button > svg"); - expect(icon).toHaveAttribute("data-icon-name", "expand_all"); + it("uses 'collapsed' as className prop value when isExpanded", () => { + const { container } = plainRender(); + const field = container.querySelector("[data-type='agama/field']"); + expect(field.classList.contains("collapsed")).toBe(true); }); }); diff --git a/web/src/components/layout/Icon.jsx b/web/src/components/layout/Icon.jsx index 848d4859cc..813185a42f 100644 --- a/web/src/components/layout/Icon.jsx +++ b/web/src/components/layout/Icon.jsx @@ -41,6 +41,7 @@ import ExpandMore from "@icons/expand_more.svg?component"; import Feedback from "@icons/feedback.svg?component"; import Folder from "@icons/folder.svg?component"; import FolderOff from "@icons/folder_off.svg?component"; +import FrameInspect from "@icons/frame_inspect.svg?component"; import Globe from "@icons/globe.svg?component"; import HardDrive from "@icons/hard_drive.svg?component"; import Help from "@icons/help.svg?component"; @@ -63,6 +64,7 @@ import SettingsApplications from "@icons/settings_applications.svg?component"; import SettingsEthernet from "@icons/settings_ethernet.svg?component"; import SettingsFill from "@icons/settings-fill.svg?component"; import Shadow from "@icons/shadow.svg?component"; +import ShieldLock from "@icons/shield_lock.svg?component"; import SignalCellularAlt from "@icons/signal_cellular_alt.svg?component"; import Storage from "@icons/storage.svg?component"; import Sync from "@icons/sync.svg?component"; @@ -109,6 +111,7 @@ const icons = { feedback: Feedback, folder: Folder, folder_off: FolderOff, + frame_inspect: FrameInspect, globe: Globe, hard_drive: HardDrive, help: Help, @@ -132,6 +135,7 @@ const icons = { settings_applications: SettingsApplications, settings_ethernet: SettingsEthernet, shadow: Shadow, + shield_lock: ShieldLock, signal_cellular_alt: SignalCellularAlt, storage: Storage, sync: Sync, diff --git a/web/src/components/storage/BootConfigField.jsx b/web/src/components/storage/BootConfigField.jsx index da2d942b19..b62ccf14fb 100644 --- a/web/src/components/storage/BootConfigField.jsx +++ b/web/src/components/storage/BootConfigField.jsx @@ -47,7 +47,7 @@ const Button = ({ isBold = false, onClick }) => { return ( ); }; @@ -68,7 +68,7 @@ const Button = ({ isBold = false, onClick }) => { * @property {boolean} configureBoot * @property {StorageDevice} bootDevice */ -export default function BootConfigField ({ +export default function BootConfigField({ configureBoot, bootDevice, defaultBootDevice, @@ -104,7 +104,7 @@ export default function BootConfigField ({ return (
- { value }